Hamlet tells Horatio, and incidentally Marcellus (because he is privy to knowledge that the ghost has appeared and spoken to Hamlet), that he will feign an "antic disposition" because, in a very human way (and Hamlet is nothing if not very human) he needs an ally. Realize, Horatio is the only character in the play who is totally honest. Even Hamlet presents a false visage to everyone else in the play, save Horatio.
Hamlet is not crazy. His antic disposition is all guile, a shield and delay tactic that affords him some time to plan and test his theories. Claudius knows this from observing Hamlet in the nunnery scene "... what he spake, though it lacked form a little,/ Was not like madness." And any reader or theatergoer would be wise to not mistake moments of desperate passion for madness. The “mad in craft” aspects of the play give Shakespeare a chance to work through one of his favorite motifs–the metatheatrical awareness that so many of his characters possess. Throughout the play Hamlet is actor, director and playwright–never more keenly aware of his own role on the stage than in Act V when mortally wounded he says to the court who have been watching their monarchy implode:
You that look pale, and tremble at this chance,
That are but mutes or audience to this act,
Had I but time, as this fell sergeant death
Is strict in his arrest, oh I could tell you –
In Shakespearean tragedy the protagonist (Hamlet) must suffer from a tragic flaw, which will inevitably lead to his own downfall. In Hamlet, Hamlet suffers from the tragic flaw of inaction. When he first encounters the ghost of his father who asks him to avenge his most foul murder, Hamlet agrees to take on this quest for avenging his father’s death. He even tells his friends that he would act crazy a scheme to help him in his quest to murder King Claudius (it never helps him though).
However, later on in the play, after Hamlet accidentally kills Polonius (thinking that it was the King) and hides the body, one begins to think that Hamlet may no longer be pretending. This great and stressful task of avenging his father’s death weighs on him heavily – and it may have gotten the best of him.