In Hamlet, what events happen directly before and after the "To Be or Not To Be" soliloquy?
Interestingly, it is the soliloquies in Hamlet that move the drama as they are intermediaries between resolve and non-performance.
The famous fourth soliloquy of the play is preceded by Hamlet's resolve to let the the action of the play, which will mimic the real actions of King Claudius, elicit a reaction from him that will then reveal the truth about King Hamlet's death.
The play's the thing
Wherein I'll catch the conscience of the king. (2.2561-562)
Directly before the soliloquy of Act III, Scene 1, King Claudius dismisses Rosencrantz and Guildenstern who tell the king that Hamlet seems excited about the forthcoming play. Gertrude and Claudius say that they will attend. Claudius then dismisses Gertrude, saying he and Polonius are going to spy on Hamlet when he meets Ophelia, who has been given a book to walk around with. They want to know if it is Ophelia's love that makes Hamlet suffer. As Polonius and Claudius wait, in an aside, Claudius is bothered by his conscience as he thinks of his evil deed against his brother.
Then is my deed to my most painted word.
O heavy burden! (3.1.53-54)
Hamlet then enters and launches into this soliloquy in which he considers suicide. Afterwards, he encounters Ophelia, who tells him that she wishes to return his "remembrances" to her. But, Hamlet denies having given her anything; further, he bemoans the dishonesty of beauty, and he says to her, "I did love thee once," implying that he does so no longer, and he urges her to "Get thee to a nunnery" (3.1.114-119).