For many years, Hamlet in Shakespeare's play has been accused of being unable to make a decision. In fact, his indecisiveness is most often recognized as his tragic flaw, which leads to his death.
For my part, I always feel that Hamlet gets a raw deal when it comes to his bad "rep." He is a young man who does not have the experience in life and politics that Claudius has—this seems to be the argument as to why Claudius takes the throne rather than Hamlet. Research recognizes that historically in Denmark, if an heir was too young to take the throne, a council would rule as to who would take that position. However, Hamlet's main concern is not that Claudius is King (it's only referenced briefly). He is upset over his father's death and his mother's remarriage, a seeming betrayal on her part, as Hamlet sees it.
Hamlet is totally unprepared for the news of his father's murder by the Ghost. He never suspected such a thing: life for Hamlet with his family has been peaceful and without the strife Claudius' actions bring. With Hamlet's lack of experience in dealing with treachery like Claudius', he seems then a novice in dealing not only with the responsibilities of ruling a kingdom, but also in knowing how to react in the face of such evil.
Hamlet is also raised with the rules of the Church. He believes, too, in supernatural powers. Elizabethans believed that there were witches and ghosts. They were also certain that the powers of darkness did all they could to trick a man (or woman) into forfeiting his/her eternal soul through the evils of the Devil. Hamlet's first source of indecision is trying to decide if the Ghost is an honest one. For if the Ghost is not, it will do all it can to get Hamlet to kill Claudius without reason—then going to hell. (This is why Hamlet does not kill Claudius while he is praying, for fear that Claudius will have a clean soul and his father's murderer will go to Heaven.)
Hamlet tells Horatio that it is an "honest" ghost...
It is an honest ghost, that let me tell you. (I.v.152)
But it seems that he can only be sure by having Claudius admit to his actions in some way. (A man's soul was more important than his life; Hamlet cannot be casual about this.) So he sets a trap in Act Three, with the play that reenacts Old Hamlet's murder. And Claudius gives Hamlet his proof.
He poisons him i' the garden for his estate. His name's(250)
Gonzago. The story is extant, and written in very choice
Italian. You shall see anon how the murderer gets the love of
Gonzago's wife... (III.ii.249-253)
Give me some light. Away! (258)
In this regard, that Claudius seems to be guilty Hamlet can only prove in time. His "seemingly" mad behavior confuses the King and the court—buying him time. However, with proof, Hamlet acts when he should not, killing Polonius—believing it was Claudius:
What, ho! Help, help, help!(25)
How now, a rat? [Draws.] Dead for a ducat, dead!
O, I am slain!
[Falls and dies.]
And then he hesitates (as noted above) to kill the King while he prays. No other opportunity is offered again before the final scene.
I believe Hamlet is a victim of his innocence, Claudius' sophistication and treachery, and timing. By the time Hamlet knows Claudius is guilty (and not just seeming so), Claudius puts his evil plan to kill Hamlet into action, and everyone dies. I believe Hamlet does the best he can based on his upbringing, his belief systems, and his inexperience.