Hamlet is the protagonist in William Shakespeare's Hamlet, and he fears that his father was murdered by his uncle. When he meets his father's ghost, Hamlet's suspicions are confirmed: Claudius killed King Hamlet while he was sleeping. Now he has been given one task by his father. The ghost asks him
Immediately Hamlet vows to carry out his father's wish and avenge his death by killing Claudius, though we do not know the particulars of his plan except that he warns his friends that he may "put an antic disposition on." We also know he has put his plan into action because people are starting to notice his odd and erratic behavior.
Despite that, Hamlet does not act for several reasons. First, he is beset with distractions. Rosencrantz and Guildenstern are unexpectedly visiting, he is battling thoughts of suicide, he is maintaining a relationship with Ophelia, his mother is acting like she never loved him or his father, Horatio keeps warning him to follow his instincts, and he understands that he is in the middle of a fight for his own life with Claudius.
Second, Hamlet is just not completely sure that what his father's ghost told him was true. One belief of the day was that ghosts would try to lure people to their deaths, which is something Horatio is afraid of for his friend. Hamlet spends a lot of time trying to eliminate all doubt before he acts, a virtually impossible task.
Third, murder is a weighty act. Just as he is appalled that Claudius could have murdered his own brother, so Hamlet has to be appalled at the thought of committing murder himself, even with just cause.
Fourth, Hamlet is a man who understands that what happens after one's death matters. In his "To be" speech, Hamlet laments having to bear the burdens of life but understands
...that the dread of something after death,
The undiscover'd country from whose bourn
No traveller returns, puzzles the will
And makes us rather bear those ills we have
Than fly to others that we know not of.
For the same reason, he does not kill Claudius when he has the chance because he fears Claudius may have just made his confession, and Hamlet does not want him to die with a clean soul.
Finally, Hamlet simply does not have the temperament to commit this act. It is odd that he can so easily condemn Rosencrantz and Guildenstern to death, but that is because he is certain of their crime of double-dealing. In the end, Hamlet is not able to kill Claudius until Hamlet is mortally wounded and has only one chance to fulfill his promise.
Ironically, the one time Hamlet does act, he kills the wrong man. That, too, undoubtedly keeps Hamlet from taking action.
One of the big questions of the play. And shall we say it is one of Shakespeare's mirrors, held up to nature or more particularly held up to us, the audience. Human nature is such that given our faculty for reason it should come as no surprise that daily life is torn between our inclinations, our urges, our instincts, to act and our ability to think through and consider the consequences. This is the essence of the "To be" speech and essentially the subject of all of Hamlet's soliloquies. This problem or attribute depending on how you want to see it also sits on Laertes. He delays. So does Claudius. And so do Pyrrhus and Lucianus. So the issue isn't unique to Hamlet. Hamlet gives many reasons for why he can't seem to move himself to revenge. Some are very obvious. You just need to look. As I have hinted look first to his soliloquies. You might also look at the Player King's speech after the player Queen protests the suggestion of taking a second husband. These are general observations that an aged and dying man would through experiences have observed.