Existentialism is a philosophy promulgated in the 20th century that holds that every person exists first and his nature, or essence, comes about later through the manner by which he chooses to live his life. This starting point is often called "the existential attitude," a sense of distress and confusion as one is faced with an apparently absurd, or meaningless world. In this absurdity, then, man must create his own essence, and in so doing he must be responsible for this essence; he cannot blame his actions on his nature. While this responsibility for one's actions brings about anguish in each person, the freedom to become what one chooses is also liberating.
Certainly, Hamlet displays "the existential attitude" throughout the play, especially in his soliloquies.
In his first soliloquy of Act I, he contemplates the absurdity of the world,
How weary, stale, flat and unprofitable
Seem to me all the uses of this world! (1.2.136-137)
In Act II, Hamlet speaks with Guildenstern and Rosencrantz, alluding to the existential creation of self, Hamlet tells them,
for there is nothing either
good or bad but thinking makes it so. (2.2.257)
Also with Guildenstern and Rosencrantz, Hamlet reflects upon the essence of man, albeit sarcastically,
What a piece of work is a man! how
noble in reason! how infinite in faculty! in form and moving
how express and admirable! in action how like an angel! in apprehension how like a god! the beauty of the world, the
paragon of animals! And yet to me what is this quintessence
of dust? Man delights not me—(2.2.308-313)
In this same scene, in a soliloquy, Hamlet contemplates his alienation and his disappointment in his attempts to find his essence:
Now I am alone.
O, what a rogue and peasant slave am I! (2.2.542-543)
His famous "to be or not to be" soliloquy is quintessentially existential as he contemplates the very meaning of existence,
To be, or not to be, that is the question (3.1.63)
In Act IV, he yet seeks the essence of man,
What is a man,
If his chief good and market of his time
Be but to sleep and feed? A beast, no more.
Sure, he that made us with such large discourse,
Looking before and after, gave us not
That capability and godlike reason
To fust in us unused (4.4.35-41)
Throughout the play, Hamlet essays to define man and his essence and to act with deliberation and responsibility as a man. Jean-Paul Sartre, a leading Existentialist declared, "Etre homme, etre responsable" [to be man is to be responsible], and Hamlet truly becomes responsible after he observes Fortinbras in Act IV,
...a delicate and tender prince,
Whose spirit with divine ambition puff'd,
Makes mouths at the invisible event,
Exposing what is mortal and unsure
To all that fortune, death, and danger dare,
Even for an eggshell. (4.4.50-55)
For, he is inspired to find his essence as man. Declaring, "This is I, Hamlet the Dane," Hamlet has found himself and is free. He accepts his existential responsibility and duels Laertes, but is reconciled with him as King Claudius and his mother die. Hamlet gives his kingdom to Fortinbras, knowing this noble man will rule well. Hamlet the Dane creates his own essence and is liberated in death.