The only evidence one might have for whether or not Hamlet is "truly" insane in any given moment in the play is what he says or what others say about him. The problem with relying on what characters say about themselves or others is that they are not always telling the truth. How to know?
Well, you can't know for sure, actually. That's why they call it a play, and it's one of the reasons that Hamlet, in particular, has fascinated audiences for centuries. There are as many choices to make about whether Hamlet is insane or not (and at which moment he might or might not reveal actual insanity or that he is merely "play-acting") as there are actors willing to attempt the role.
I can give you evidence of what Hamlet says both to Horatio and Marcellus in Act I and, again, in Act III to Gertrude about his "play-acting," but this is not some sort of conclusive evidence of what is really going on with Hamlet. It is pretty widely considered to be true that a person who is insane is usually the last one to know. Most insane people don't recognize themselves as such. Here are the scenes and text from Acts I and III in which Hamlet reveals that his insanity will be and is a ruse:
Here as before, never, so help you mercy,
How strange or odd some-er I bear myself --
As I perchance hereafter shall think meet
To put an antic disposition on --
and, in III, iv, in attempting to convince Gertrude not to allow Claudius back into her bed:
What shall I do?
Not this, by no means, that I bid you do;
Let the boat King tempt you again to bed,
. . .And let him, for a pair of reechy kisses,
. . .Make you to ravel all this matter out
That I essentially am not in madness,
But mad in craft. (lines 182- 190)
There are numerous moments in the play in which the other characters (in fact, nearly all the characters except Horatio) discuss Hamlet's "madness" as if this state of mind is a given fact. Polonius and Claudius go farther, attempting to discover the reason for his "madness." However, other characters' opinions of his behaviour don't solve the question of whether he is play-acting or not. These characters are only witnessing his actions, which is not any sort of evidence for what is going on internally with Hamlet.
Perhaps the largest body of evidence that can be put forward for Hamlet's sanity are his lucid and eloquent soliloquies -- his conversations with the audience, during which he reveals his inmost thoughts. These do not seem to be the ravings of a mad man, but rather the tormented thoughts of a lucid, highly intelligent, grief-stricken man.
All of this being said, this is a question that has been debated through the centuries. For more on Hamlet and madness versus play-acting, please follow the links below.
One of the themes in the play is acting vs reality. In Hamlet Shakespeare has provided a broad canvas upon which to place his character. Actors and directors can play him insane or only acting a little unstable. Hamlet at various points alternates between telling us he is both mad and not mad. So, there really isn't one truth to the issue.
For Shakespeare acting is reality and reality is acting. People put on acts all the time. At the beginning of the 2nd scene, Claudius puts on a show. How much of that is an act? In Hamlet's "seems" speech in the same scene, is he acting or is he grieving? Claudius and Gertrude clearly think it is just a truculent act. Does the Player King really weep for Hecuba or is it fake? Is there a difference?
Claudius sees a method to Hamlet's madness and yet Polonius is convinced Hamlet is mad from neglected love. Gertrude thinks it is her o'er hasty marriage and the death of King Hamlet. Rosencrantz and Guildenstern see Hamlet as ambitious. This may tell us more of each of these characters than it does about Hamlet. Is Hamlet mad? It really depends on the actor and the observer.