Natalie Elliot in The New Atlantis:
In Act V of Hamlet, after Hamlet has killed Polonius, Ophelia has died, and Hamlet has returned to Denmark from his murderous trip to England, he happens upon two gravediggers. It is an odd and puzzling scene, and a noticeable departure from the rising action of the play. At this juncture, we expect Hamlet to clash with his rivals. Instead, we get a deeply philosophical and darkly comic exchange on death, with the gravediggers singing as they toss around bones and Hamlet wondering about the lives of the skeletons before him:
That skull had a tongue in it and could sing
once….
There’s another. Why may not that be the
skull of a lawyer? Where be his quiddities now, his
quillities, his cases, his tenures, and his tricks? Why
does he suffer this mad knave now to knock him
about the sconce with a dirty shovel and will not tell
him of his action of battery?
Later, Hamlet turns from the unfeeling coarseness of the gravediggers to morbid curiosity about the bodies, asking, “How long will a man lie i’ th’ earth ere he rot?”
The question of what comes after death has been on Hamlet’s mind throughout the play. Considering suicide, he wonders “what dreams may come / When we have shuffled off this mortal coil.” He seems torn between Catholic and Protestant accounts of the afterlife: Soon after returning from the University of Wittenberg, a center of the Protestant Reformation, Hamlet encounters what appears to be a strikingly Catholic specter — the ghost of his father, claiming his earthly sins must be “burnt and purged away” in purgatory — but he vacillates on whether the ghost can be believed. By the time he meets the gravediggers, Hamlet’s questions about the afterlife, still unsolved, turn to the physical realm: He wants to know about the material nature of corpses.
Hamlet’s curiosity about bodies is significant not only because it recalls some of the materialistic ideas he entertained earlier in the play — that man is nothing more than a “quintessence of dust,” or that the dead Polonius is simply a bag of guts — but also because it suggests that Shakespeare was engaging with the science of his time.
More here. [Thanks to Simon Dedeo.]