Death permeates Hamlet right from the opening scene of the play, where the ghost of Hamlet’s father introduces the idea of death and its consequences. The ghost represents a disruption to the accepted social order – a theme also reflected in the volatile socio-political state of Denmark and Hamlet’s own indecision.
This disorder has been triggered by the "unnatural death" of Denmark's figurehead, soon followed by a raft of murder, suicide, revenge and accidental deaths.
Hamlet is fascinated by death throughout the story. Although this is deeply rooted in his character, it could be a product of his grief. Hamlet’s most potent consideration of death comes in Act 4, Scene 3. His almost morbid obsession with the idea is revealed when asked by Claudius where he has hidden Polonius’ body.
At supper ... Not where he eats, but where a is eaten. A certain convocation of politic worms are e’en at him. Your worm is your only emperor for diet. We fat all creatures else to fat us, and we fat ourselves for maggots. Your fat king and your lean beggar is but variable service – two dishes, but to one table. That’s the end.
Hamlet is describing the life-cycle of human existence. In other words: we eat in life; we are eaten in death. The frailty of human existence haunts Hamlet throughout the play and it’s a theme he returns to in Act 5, Scene 1: the iconic graveyard scene. Holding Yorick’s skull, he explores the brevity and futility of the human condition and the inevitability of death:
No, faith, not a jot; but to follow him thither with modesty enough, and likelihood to lead it, as thus: Alexander died, Alexander was buried, Alexander returneth into dust, the dust is earth, of earth we make loam, and why of that loam whereto he was converted might they not stop at a beer-barrel?
This sets the scene for Ophelia’s funeral where she too will be returned to the ground.
The idea of suicide also emerges from Hamlet’s preoccupation with death. Although he seems to consider this is an option, he does not act. Similarly, he does not act when he has the opportunity to kill Claudius and avenge the murder of his father in Act 3, Scene 3. Ironically, it is this lack of action on Hamlet’s part that ultimately leads to his death at the end of the play.