Why does Hamlet hesitate to kill Claudius?
Ah, this is a subject which can be interpreted several different ways. See the first link below for some answers to a very similar question.
There several ways of looking at this, but two of the most immediate are a) what does Hamlet say about why he doesn't kill Claudius? and b) what do we, as the audience (or readers) of the play think about why Hamlet doesn't kill him? Neither of these may definitively answer the question, but it's a good place to start our exploration of why Hamlet doesn't take this very easy opportunity to kill his hated stepfather.
Let's first explore what Hamlet says about it (because, in true Shakespearean fashion, most or all of a character's emotions and motivations are displayed to the audience by the device of soliloquy, which is really just the character talking to himself.) This is Act III, scene 3.
Now might I do it pat, now he is praying;
And now I'll do't. And so he goes to heaven,
And so am I revenged. That would be scann'd.
A villain kills my father; and for that,
I, his sole son, do this same villain send
Up, sword, and know thou a more horrid hent.(90)
When he is drunk asleep; or in his rage;
Or in the incestuous pleasure of his bed;
At game, a-swearing, or about some act
That has no relish of salvation in't
Then trip him, that his heels may kick at heaven,(95)
And that his soul may be as damn'd and black
As hell, whereto it goes.
What's young Hamlet saying here? He's saying that he could do it "pat" (easily) -- kill his stepfather easily, without too much risk to himself. But he doesn't -- and the reason he says that he doesn't is that this would be "hire and salary" (III.iii.81) (in other words, he'd be doing Claudius a favor by sending him to heaven when his soul was clean, and therefore enabling this murderer to go to heaven). Hamlet says that he wants to "take" (86) Claudius when he is sinning, and then he enumerates those sins. This would mean, according to Hamlet's Catholic beliefs, that Claudius would go to hell, or at least purgatory, for his unforgiven sins. Hamlet has this foremost in his mind because he has just seen the ghost of his father, who has told him that he is in purgatory (Act I, Scene iv). Of course, the vengeful son would want at least as bad an afterlife for his father's murderer as for his own father. This is a neat, doctrinally sound excuse for not killing Claudius -- if you overlook the fact that Christian doctrine expressly forbids killing! So Hamlet is splitting hairs here -- and we think that he knows it.
So, the audience/reader is left to think of why Hamlet might not be motivated, at that moment, to kill Claudius. One might be for his own safety; he might be afraid of Claudius's friends (not to mention his own mother's, Claudius's wife) reprisals. Perhaps he shrinks from killing a king because people might accuse him of the same thing that Claudius did: of killing a sitting king in order to inherit his throne for himself! This would certainly give any honest, moral person pause, especially when the murdered person was his own father. Or, perhaps, we are meant to think that Hamlet is truly a good person, and is only driven towards murder because of circumstances, not because of his nature. These are all valid interpretations, and there are many others.
Hamlet, in Shakespeare's Hamlet, tells you himself why he hesitates to kill Claudius:
Now might I do it pat, now 'a is a-praying,
And now I'll do't--and so 'a goes to heaven,
And so am I revenged. That would be scanned [looked at or thought about again].
A villain kills my father, and for that,
I, his sole son, do this same villain send
Why, this is hire and salary, not revenge. (Act 3.4.73-79)
Hamlet's Catholic beliefs suggest that if Claudius dies just after he's confessed, he will be forgiven of all of his sins and he will go to heaven. Hamlet doesn't want to send Claudius to heaven.
Hamlet's father, in the form of the Ghost, is lingering in a purgatory-like state, and Hamlet, if he were to kill a king, may go straight to hell. Thus, Hamlet reasons, Claudius, the evil one of the three, will be the only one of the three to be rewarded with eternal salvation if he kills Claudius while he is confessing.
Ironically, Claudius, while he is praying, is not really confessing. He is unwilling to give up the benefits of his sin, and therefore does not confess or repent. Hamlet could have killed Claudius while Claudius was praying, and order would have been restored in Denmark, presumably.
This makes Hamlet's decision to walk away and to not kill Claudius the climax of the play. Hamlet is guilty of hubris, attempting to rise above his station in life. Salvation is God's business, not Hamlet's. Hamlet is playing God when he attempts to determine another human's eternal salvation. The terrible loss of so many lives after Hamlet decides not to kill Claudius could have been avoided.