HAMLET. As I perchance hereafter shall think meet
To put an antic disposition on— (1.5.191–192)
Hamlet's madness? He's faking it. At least that's how hit appears at first in Shakespeare's Hamlet, but it remains to be seen during the rest of the play if that statement holds true.
There's no indication in the play prior to Hamlet's "I'm going to feign madness" statement made in confidence to Horatio, Marcellus, and Bernardo in act 1, scene 5, that Hamlet is mad or that he has any particularly propensity for madness.
It might well have been Horatio who planted the seed of feigning madness into Hamlet's mind during the prior scene in which the Ghost of Hamlet's father first appears to them. Horatio warns Hamlet against following the Ghost away from the protection of his friends:
HORATIO. What if it tempt you toward the flood, my lord,
Or to the dreadful summit of the cliff
That beetles o'er his base into the sea,
And there assume some other horrible form,
Which might deprive your sovereignty of reason
And draw you into madness? Think of it. (1.4.75–80)
It's a thought.
At the beginning of the play, Hamlet is grieving for his father's death, and there seems to be some conflict developing between Hamlet and his on-again-off-again girlfriend, Ophelia, but no one makes any mention of madness in the opening scenes.
If Hamlet's behavior reflected any madness, Ophelia's brother, Laertes, surely would have mentioned it in his early scene with Ophelia (1.3.) as would have Ophelia's father, Polonius, later in the same scene—but neither of them says a word about it.
The first reference to Hamlet being mad is in act 2, scene 1. Ophelia goes to Polonius, and she says that she's been "affrighted" by Hamlet's unusual behavior:
OPHELIA. My lord, as I was sewing in my closet,
Lord Hamlet, with his doublet all unbraced,
No hat upon his head, his stockings fouled,
Ungartered, and down-gyved to his ankle;(90)
Pale as his shirt, his knees knocking each other,
And with a look so piteous in purport
As if he had been loosed out of hell
To speak of horrors, he comes before me.
LORD POLONIUS. Mad for thy love?
OPHELIA. My lord, I do not know,
But truly I do fear it. (2.1.87–97)
"Mad for thy love"? Where did that come from?
Polonius is remembering his earlier conversation with Ophelia about Hamlet professing his love for her, and he simply puts two and two together. Hamlet must be mad to behave this way, and his madness is no doubt due to his love for Ophelia.
Surprisingly, Ophelia doesn't see through Hamlet's overly-exaggerated behavior, and now Ophelia thinks Hamlet must be mad for his love for her, too.
Polonius questions Ophelia further about the matter. Ophelia says that she did what Polonius told her to do—"I did repel his fetters and denied / His access to me" (2.1.121–122)—and Polonius is even more convinced of his own conclusion:
POLONIUS. That hath made him mad. (2.1.123)
From this point forward, and through the rest of the play (at least until Hamlet kills him in act 3, scene 4) Polonius is utterly convinced that Hamlet's unrequited love for Ophelia is the reason for his madness.
Polonius hurries to Claudius and Gertrude with news of his discovery of the reason for Hamlet's madness:
POLONIUS. I will be brief: your noble son is mad. (2.2.98)
This comes as news to King Claudius, Hamlet's uncle, and his wife, Gertrude, Hamlet's mother, since Hamlet had exhibited no previous signs of madness to them. Polonius tells Claudius and Gertrude that Hamlet's madness is due to his love for Ophelia, and he reads a love letter to them that Hamlet wrote to Ophelia. Claudius and Gertrude tend to agree with Polonius, but they aren't completely convinced.
Polonius offers to prove it to them by setting up Ophelia as a guinea pig in an experiment with Hamlet:
POLONIUS. You know, sometimes he walks four hours together
Here in the lobby.
QUEEN. So he does indeed.
POLONIUS.vAt such a time I'll loose my daughter to him.
Be you and I behind an arras then;
Mark the encounter. If he love her not,
And he not from his reason fall'n thereon
Let me be no assistant for a state,
But keep a farm and carters. (2.2.174–179)
Before Polonius can subject Hamlet to the "mad for Ophelia's love" experiment, Hamlet acts crazy with Polonius (talking about fishmongers and asking Polonius whether he has a daughter) and with Rosencrantz and Guildenstern ("I am but mad north-north-west. When the wind is southerly I know a hawk from a handsaw").
Polonius has a momentary realization that all might not be as it seems with Hamlet's madness—"Though this be madness, yet there is a method in't" (2.2.216)—but Polonius is so convinced that Hamlet is mad for love that he simply dismisses the idea.
The Players enter, and Hamlet acts perfectly normal with them. Hamlet's soliloquy at the end of the scene reveals no sign of madness, and his soliloquy is logically and reasonably concluded:
HAMLET. The play's the thing
Wherein I'll catch the conscience of the King. (2.2.599–600)
Claudius talks to Rosencrantz and Guildenstern about Hamlet's "lunacy," which seems a little odd to him because Hamlet showed no previous signs of madness:
CLAUDIUS. And can you by no drift of conference
Get from him why he puts on this confusion,
Grating so harshly all his days of quiet
With turbulent and dangerous lunacy? (3.1.1–4)
Polonius finally gets a chance to conduct his experiment with Ophelia and Hamlet, which proves to be inconclusive, although Ophelia believes that something is definitely wrong with Hamlet, and he might well be mad.
Polonius remains firmly convinced of his own conclusions about Hamlet's madness, but Claudius is even less convinced than he was before the experiment with Hamlet and Ophelia:
CLAUDIUS. Love? His affections do not that way tend;
Nor what he spake, though it lack'd form a little,
Was not like madness. (3.1.171–173)
Polonius suggest that Claudius should send Hamlet to England for a while to help cure his madness, and Claudius agrees, although Claudius's intent in sending Hamlet to England is to have him killed not cured:
CLAUDIUS. It shall be so.
Madness in great ones must not unwatch'd go. (3.1.196–197)
There's no significant change in the major characters' attitudes toward Hamlet's madness for the rest of the play.
Polonius firmly believes until his death behind the arras that Hamlet is mad for Ophelia's unrequited love.
Ophelia thinks that Hamlet is seriously unbalanced, but she's not sure why.
Gertrude believes what she believed in act 2, scene 2: that Hamlet is probably mad for love —"It may be, very like" (2.2.160). However, in her scene with Hamlet during which Hamlet kills Polonius, Hamlet tells her that he's been feigning madness to protect himself from Claudius. This only seems to confuse Gertrude, because in the same scene Hamlet also says that he can see dead people.
Claudius is convinced that Hamlet is feigning madness.
Laertes has been away in France, so he has no absolutely no idea what's been going on with Hamlet, other than that Hamlet killed Polonius. Laertes is much more concerned with his sister's apparent madness, which raises another question entirely.
Hamlet takes the answer to the question of his madness to the grave. He tells Laertes before their duel that he killed Polonius because of his madness, which he says he couldn't control:
HAMLET. What I have done
That might your nature, honour, and exception
Roughly awake, I here proclaim was madness.
Was't Hamlet wrong'd Laertes? Never Hamlet.
If Hamlet from himself be taken away,
And when he's not himself does wrong Laertes,
Then Hamlet does it not, Hamlet denies it.
Who does it, then? His madness. If't be so,
Hamlet is of the faction that is wrong'd;
His madness is poor Hamlet's enemy. (5.2.223–230)
That's Hamlet's story, and he's sticking with it.