Hamlet is given to much self debate. What does Hamlet think about in Act 5 of Hamlet?
In addition to Hamlet's sense of identity in that he is now Prince of Denmark, after looking at the skulls of the graveyard he realizes that death is a great equalizer. And, with his graveyard experiences, Hamlet now has a sense of fate--
When our deep plot fail and that should teach us that
There's a heavenly power that shapes our ends,
No matter how much we think we're in control.(5.2.8-10)
With this new self-definition and the awareness of Fate and equality of death, Hamlet declares that he feels no guilt about the deaths of Rosencrantz and Guildenstern who have tried to have him killed:
Does by their own insinuation grow. (5.2.62-63)
Likewise, Hamlet, Prince of Denmark, feels justified and driven by Fate now in avenging his father's murder against Claudius who must be stopped:
Does it not, think thee, stand me now upon--
He that hath killed my king and shored my mother,
Popped in between th'election and my hopes,
Throw out his angle for my proper life,
And with such coz'nage--is't not perfect conscience
To quite him with this arm? And ist' not to be damned
To let this canker of our nature come
In further evil? (5.2.68-75)
Inspired further by the noble character of Fortinbras, the once self-debater has reached his final resolve as the Prince of Denmark. He must be rid of the king. So, he accepts the challenge and has to duel Laertes. After this duel, Claudius is slain. However, as he lies weakened and dying, Hamlet reconciles with Laertes and hands over the power of Denmark to Fortinbras, defeating the king.
In Act 5 he is ready to take action and he is thinking about the fact that life is filled with moments shaped by fate and moments shaped by free will. Most of life is a mix of both. Early in the act he tells Hortatio, "There is a divinity that shapes our ends, rough hew them how we will." He is clearly commenting on that mix here. It is fate that put him on a boat to England and fate that has him find the orders for his death in England. He takes control of that situation by changing the letter, and as fate would have it, he even has his father's signet ring to seal the letter. He claims he is ready for whatever will come now. He may be suspicious of the dueling match, but he tells Horatio, "The readiness is all." His fate has him in this match, and he can do his best to be ready for what may come, but in the end he can only do his best. In his giving himself over to this understanding, it seems to free him to act as he must.