Hamlet is the protagonists of the novel and his obligation is to kill his uncle, Claudius, who kills his father and take revenge, and that cause his life finally together he make the people surround him die because his revenge. In the novel, he has more one chance to kill Claudius, but he gives up. In my opinion, the reason for him hesitates to take action for long time is due primarily to religious and psychological.
With the religious affect, he does not want Claudius go to heaven. The first time that Hamlet has chance to kill Claudius is in the confessionary. Claudius is praying to God for his sin, killing his brother and marry his brother's wife and asking God forgive him. At that time, Claudius does not know Hamlet is setting in the next room that expects is a father sitting there. Hamlet uses his coutel to kill Claudius by puncture to his ear but he give up this chance.
The reason for that is because in the religious point of view that Claudius admitted his sins and God is already forgive him, therefore, if Claudius at that moment, he will right straight go to heaven. However, for hamlet it is not acceptable to let a man who kill his father go to heaven and yet his father died without confess and that him suffering being a ghost in the world and cannot go to heaven.
Moreover, the other reason to make Hamlet hesitate to kill Claudius is psychological problems because he is not ensuring Claudius is the murderer. Although he saw his father's ghost and was told that his father's death is not an accident, is murder, he still try to prove that Claudius is the murderer. He trusts what his father tells him but...