In Shakespeare's Hamlet, the play abounds with images of death from the very beginning.
At the start, Hamlet is struggling with his father's death; he greatly resents his mother's hasty remarriage to his father's brother (and Hamlet's uncle) Claudius. He is so distressed that he has considered suicide and is upset that God has forbidden it:
O, that this too too sullied flesh would melt,
Thaw and resolve itself into a dew,
Or that the Everlasting had not fix'd
His canon 'gainst self-slaughter! (I.ii.132-135)
At the beginning, Hamlet does not seem to be concerned with dying. Hamlet is given to believe that life after death is not pleasant, specifically for those who have died with sins still upon their souls at death—which is the way his father, Old Hamlet, died.
By the end of Act One, Hamlet goes to see if the ghost on the battlements is really his father. Old Hamlet relates that he is in purgatory where "for a time," he must walk at night and burn in the fires during the day. The ghost warns of horrors after death for a soul unabsolved.
But that I am forbid
To tell the secrets of my prison-house,
I could a tale unfold whose lightest word
Would harrow up thy soul, freeze thy young blood,
Make thy two eyes, like stars, start from their spheres,
Thy knotted and combined locks to part,
And each particular hair to stand an end
Like quills upon the fretful porpentine. (I.v.18-24)
In Act Five, scene one, Hamlet and Horatio are in the cemetery, having returned from Claudius' failed attempt to have Hamlet executed there. When Hamlet realizes that Ophelia has died, he says he is ready to die himself. He jumps into the grave with her body, overcome with grief that she is gone. He argues with Laertes that he (Hamlet) loved Ophelia more than anyone, and his grief is genuine.
'Swounds, show me what thou'lt do.
Woo't weep, woo't fight, woo't fast, woo't tear thyself?...
I'll do't. Dost thou come here to whine,
To outface me with leaping in her grave?
Be buried quick with her, and so will I. (275, 277-280)
In Act Five, scene two, Hamlet is aware that Claudius and Laertes are probably planning his death in the "friendly" sword fight in which the two younger men are to engage. Again, Hamlet seems not to fear death. He has lost so much, that death is like a shadow. Horatio tells Hamlet that if he has a bad feeling about the contest, Horatio will make an excuse to delay the event. Hamlet tells him not to worry: the time of his death is already set—whether it be today, or tomorrow or sometime in the future. Hamlet notes that once dead, a man will not be aware of what happens after his death, so dying early should be of no concern.
If your mind dislike anything, obey it. I will forestall
their repair hither and say you are not fit.
Not a whit, we defy augury; there's a special
Providence in the fall of a sparrow. If it be now, 'tis not to
come, if it be not to come, it will be now; if it be not now,
yet it will come. The readiness is all. Since no man has
aught of what he leaves, what is't to leave betimes? Let be. (209-215)
Hamlet is a tragedy. The main character is a tragic hero. The play reeks of death. Once Hamlet's father dies, depression sets in. His distaste for his uncle, his assumption that his mother has forgotten his father, and then Ophelia's death have changed the man we can believe was once happy, into a shadow of his former self. Death seems not to scare Hamlet.