What changes in his attitude toward death does Hamlet show in his words to Horatio?
Horatio tells his friend, Hamlet, that if he has any misgivings about the duel with Laertes, he should listen to them, and Horatio offers to tell the crowd that Hamlet is feeling ill. However, Hamlet will not hear of it. He says that he sets no store by superstition. Further, he continues,
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 of aught he leaves knows, what is 't to
leave betimes? Let be. (5.2.205-210)
In other words, Hamlet now thinks that God is in control of everything, even something as small as the death of a sparrow. He says that if death is supposed to come now, then it will. If death is supposed to happen later, then it won't happen now. However, the important thing is to be ready for it. None of us knows anything about what we leave behind us when we die, so what does it mean to die early? We must make peace with it.
This is a significant departure from the depressed young man who said,
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? (3.1.57-61)
Earlier, Hamlet had considered ending his own life, asking whether or not it's better to be alive or dead. He wondered if it was better to put up with all the terrible things life throws at us or to fight, escaping by choosing one's own death. He thinks of dying as a kind of sleep, a sleep that allows us to get away from all our pain and heartache. It seems that Hamlet used to think that he was completely in control of his life and his death, that he could simply choose to end it whenever he wanted. By the time he speaks with Horatio toward the play's end, it seems that Hamlet has entrusted his life to a higher power: death is no longer singular or all about him, but he now has a sense that his life and death are part of a plan, and both seem more purposeful as a result.
In Act 5 of the play, Hamlet reveals a new understanding of life and death. More specifically, he reveals that while he used to worry about his fate and used to try to control everything in his life, he has recently come to a new conclusion: what will be, will be. Hamlet spends so much of the play contemplating how he feels, making plans, giving instructions (to the actors and later to his mother), justifying and complaining about his lack of action, and, in general, thinking. But after his being sent to England and his subsequent discovery of the King's command for his death and his dealings with the pirates, he realizes that he can't control his fate. He specifically says "there is a divinity that shapes our ends, rough hew them how we will," and what he means is all we can do is give a rough shape to our lives and react as best we can to what life/fate throws at us. This realization leads to his better understanding of death and allows him to better face his own possible death. While Horatio is concerned about a possible plot with the sword fight, Hamlet just gives himself over to the fact that he might or he might not die there. He tells Horatio, "There is a special providence in the fall of a sparrow" (meaning God knows all things) and "if it (death) be now,'tis not to come; if it be not to come (in the future) it will be now . . . the readiness is all." All a person can do is be as ready as they can and respond in the best way possible to whatever happens in life. Hamlet's understanding of death comes into clearer focus even earlier in the act when he is in conversation with the gravediggers. He asks the very factual questions about death such how long it takes for a body is decompose -- a rather impersonal question. But as he holds the actual skull of Yorick, a person he once knew, death is all of a sudden very real and humanizing, and yet very much anequalizer. He is absolutely right when he remarks to Horatio that both the common man and the mighty Alexander the Great are really just dust and bones after death. All of this knowledge and understand ultimately free Hamlet to do what he needs to do to rid the throne of Claudius once and for all.