It is interesting to note that the question of Hamlet's insanity in Shakespeare's play of the same name comes up repeatedly, but I'm not sure if I understand why. Hamlet is very clear in telling Horatio (the one person he trusts at the castle) what he will be acting crazy to see if he can discovered if his father was murdered by Claudius, as the Ghost tells Hamlet.
Here, as before, never, so help you mercy,
How strange or odd soe'er I bear myself—
As I perchance hereafter shall think meet
To put an antic disposition on—
That you, at such times seeing me, never shall,
With arms encumber'd thus, or this head-shake,
Or by pronouncing of some doubtful phrase,
As “Well, well, we know,” or “We could, an if we would,”
Or “If we list to speak” or “There be, an if they might,”
Or such ambiguous giving out, to note
That you know aught of me; this is not to do,
So grace and mercy at your most need help you,
Hamlet tells Horatio that no matter how crazy he may act—putting on an "antic disposition"—Horatio cannot nod or grin or wink to indicate that Hamlet is anything less than he appears: crazy. In the midst of rumors, Horatio cannot give any sense that he knows that Hamlet is playing a game. He tells Horatio to work carefully to avoid giving anything away, especially when Horatio will want very much to say something. And then he makes Horatio swear.
Hamlet has told his only confidante in Elsinore that he plans to act crazy. Hamlet needs to find proof that will prove beyond a doubt that Claudius killed his father. He notes that the Ghost is an "honest" ghost, but he must be sure. If he kills a king wrongfully, he will lose he eternal soul for it is a mortal sin to kill a king.
That is not to say that there are not moments when Hamlet becomes extremely angry or devastated, and act a little crazy. (Is this so unusual for a person, though?) For example, when Hamlet kills Polonius, it is an accident. Polonius was in Gertrude's room, hiding. This is just after he has received irrefutable proof that the King did murder Old Hamlet. He is determined to murder Claudius, hoping to find him with sins upon his soul—the way he sent Old Hamlet into death. He sees Claudius seeming to pray and does not want to kill him, sending him into eternity with a soulless sin; but if Claudius is in Gertrude's room, he is practicing incest. (Or so the Elizabethans believed, if you married your husband or wife's relative, as married couples were considered of one flesh.) This was a perfect time to avenge Old Hamlet's death, and he kills Polonius by accident.
Neither is this madness. He is impulsive, but believes he is avenging his father's murder, for which he has collected proof.
Then, when Hamlet realizes (after all of Claudius' attempts to spy and ultimately do away with Hamlet) that Ophelia is dead, he is emotionally crushed and enraged over his loss. Seeing Ophelia's shrouded body, Hamlet jumps down into her grave, declaring his love for her—greater than the love of any brother. Laertes is infuriated, and Hamlet seems as if he is crazy, but this is only his human struggle to understand and absorb the finality of the death of a loved one...of Ophelia.
I loved Ophelia. Forty thousand brothers
Could not, with all their quantity of love,
Make up my sum. (V.i.270-272)
Well, we don't, kind of. The whole theme of image and reality is the ambiguity of each. Is Claudius all show and no substance? Does the Ghost have a reality? Are R&G just acting as friends? Is Hamlet acting mad or is he really mad? In the original Amleth legend upon which this play is loosely based the title character feigns being retarded to fool the king into thinking he has no designs on taking the throne. In Hamlet, Shakespeare has Hamlet tell us at different points in the play that he is only acting such as in in 1.5 or that he was really mad as in 5.2. Shakespeare also has characters comment on Hamlet's madness, e.g., Polonius.
The issue of madness gives the actor playing Hamlet more dramatic range to seize upon this very question. So depending on the production an actor can play the part as an act or as a reality. Within the confines of the play there is no definitive answer one way or the other.