When approaching the idea of theme in literature, one good question to ask is "beyond the plot/action, what is the work really about?"
In regards to Shakespeare's Hamlet, the answer to this question, for me, comes down to the notion of the moral conundrum of justice (law) versus morality.
This is just one way to phrase a rather complex moral/ethical scenario that stands at the heart of this play.
The character Hamlet is faced with a very difficult situation. In order to do the "right thing" in terms of justice and honor, Hamlet must revenge his father's murder. This is clear.
Yet, avenging his father's death means acting against his own mother. This is wrong as a moral act. One cannot, morally speaking, destroy one's mother (her life, her marriage, etc.) and still claim to be acting morally. This is also clear.
Thus, Hamlet's dilemma - to be (just) or not to be (just); to be (moral) or not to be (moral); to revenge his dead father against his living mother or to forgive his living mother and thereby wrong his dead father, leaving his honor sullied and his murder unavenged.
To be, or not to be, that is the question:
Whether 't is nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing, end them?
Many readers like to view Hamlet as profoundly indecisive. While it is difficult to argue against that interpretation of his character, we should not under-estimate the scale of his two options, each being rather absolute in their implications vis a vis Hamlet's spiritual state.
He has a choice between two condemnations. He can be condemned by the codes of honor and justice or condemned by the codes of morality.
Should we wonder that he is indecisive?
As we see the famous lines of Hamlet's soliloquy above, choosing action means that he will have to destroy his mother and, by extension, destroy himself. We can argue that Hamlet will have nothing left of himself morally and spiritually if he goes against his mother and her husband.
"Critics who find the cause of Hamlet's delay in his internal meditations typically view the prince as a man of great moral integrity who is forced to commit an act that goes against his deepest principles" (eNotes).
In any event, we can certainly argue that a central theme - perhaps the central theme of Hamlet is found in the conflicting sensibilities or codes of conduct represented by "justice" and "morality."
There are many themes found in William Shakespeare's tragic play "Hamlet." The first theme found in the play is revenge. The theme of revenge is made apparent through the movement of the characters' actions. Many of the characters' actions are completed based upon one, singular idea: enacting revenge upon another. At the same time, the themes of death and fate are woven together with revenge. The themes play off of each other in order to highlight how revenge typically ends in death while speaking to the fate of the character at the same time.
That said, another theme (typical of the period) is the presiding power of good. Essentially, many of Shakespeare's plays (especially the tragedies) denote the importance of good overpowering evil. The idea that good is far more powerful is seen through the tragic death of the tragic hero (typically). With the death of the tragic hero, who possesses a tragic flaw, good can triumph.