"To be or not to be...."
In what is arguably Shakespeare's most recognizable soliloquy, Hamlet attempts to reason out whether the unknown beyond of death is any easier to bear than life. The underlying theme remains Hamlet's inaction and his frustration at his own weaknesses. Here, however, Hamlet seems less introspective about his failure to kill Claudius than perhaps his failure to take his own life. This is also a speech that explores the idea of consequence.
As with many elements of Hamlet, much of the interpretation lies in the eye of the beholder and the choices made in the production. If Hamlet is portrayed as truly descending into madness, then one can take much of this soliloquy at face value. Hamlet really is depressed and thinking about killing himself as a means to end his "sea of troubles." Going by this interpretation, Hamlet is further waxing depressed with the reasoning that he's a coward for not killing either Claudius or himself. Surely, given Hamlet's first soliloquy in Act I, sc. ii ("O, that this too too solid flesh would melt"), Hamlet in his grief has mused upon the prospect of suicide.
There is another general way in which we could interpret this speech, however. If the choice is made instead to play Hamlet's madness as anything less than genuine, then there could be an entirely different element at work here. Keep in mind that the scene does not open with Hamlet's entrance; it begins with the plot of Claudius and Polonius to spy upon Hamlet's interaction with Ophelia. Claudius even says "we have closely sent for Hamlet hither." As a result, Hamlet should clearly be expecting to meet someone when he enters the scene. Perhaps he enters lost in thought; perhaps he enters with suspicion. However, if Hamlet enters the scene suspecting that he is being watched, it casts the entire scene in a different light.
In any case, this philosophical soliloquy builds on a recurrent theme throughout the playthe afterlife. The afterlife permeates Hamlet, whether it's the ghost's appearance, Hamlet's equivocation over whether to kill Claudius while he prays, or the controversy over Ophelia's burial rites at the graveyard. If death were oblivion, it might be desirable, in Hamlet's mind; the fear that it might not be is what makes it frightening to him. Of course, there is only one way to be certain, and the decision is irrevocable.
As A.C. Bradley points out, it all comes back to consequences. The consequence for Hamlet killing Claudius could very well be his own death. The consequence for taking his own life to escape his troubles could be even worse troubles in the next life. The irony of all this is that ultimately, the tragic consequences of Hamlet's inaction are the multiple unintended deaths he causes.
To be, or not to be: that is the question:
Whether 'tis 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? To die: to sleep;
No more; and by a sleep to say we end
The heart-ache and the thousand natural shocks
That flesh is heir to, 'tis a consummation
Devoutly to be wish'd. To die, to sleep;
To sleep: perchance to dream: ay, there's the rub;
For in that sleep of death what dreams may come
When we have shuffled off this mortal coil,
Must give us pause: there's the respect
That makes calamity of so long life;
For who would bear the whips and scorns of time,
The oppressor's wrong, the proud man's contumely,
The pangs of disprized love, the law's delay,
The insolence of office and the spurns
That patient merit of the unworthy takes,
When he himself might his quietus make
With a bare bodkin? who would fardels bear,
To grunt and sweat under a weary life,
But that the dread of something after death,
The undiscover'd country from whose bourn
No traveller returns, puzzles the will
And makes us rather bear those ills we have
Than fly to others that we know not of?
Thus conscience does make cowards of us all;
And thus the native hue of resolution
Is sicklied o'er with the pale cast of thought,
And enterprises of great pith and moment
With this regard their currents turn awry,
And lose the name of action.
Act III, sc. i