What does Hamlet have to overcome during the course of the play?
In William Shakespeare's Hamlet, the greatest challenge that Hamlet must overcome throughout the play is his own indecisiveness.
Hamlet suffers from what is known in modern terms as "paralysis by analysis." Hamlet refuses to make a decision or act on that decision until he has thoroughly analyzed the situation. Since Hamlet is never satisfied that he's analyzed every possible aspect of a given situation, he's continually paralyzed by indecision.
Hamlet's father comes from the grave to tell him that he was murdered by his brother, Hamlet's uncle Claudius. Despite swearing to Heaven, Earth, and Hell to avenge his father's death, Hamlet hesitates to take any action because he wants to be sure that his father's ghost was telling the truth.
HAMLET. The spirit that I have seen
May be a devil; and the devil hath power
T' assume a pleasing shape; yea, and perhaps
Out of my weakness and my melancholy,
As he is very potent with such spirits,
Abuses me to damn me. I'll have grounds
More relative than this. (2.2.593-599)
Hamlet arranges for a play to be performed at court that recreates his father's murder, and he hopes to "catch the conscience of the king" (2.2.600). In other words, Hamlet hopes to catch the King acting guilty.
Even when Hamlet does catch the king acting guilty, which proves to him that the ghost was telling the truth—"I'll take the ghost's word for a thousand pound" (3.2.275-276)—Hamlet still does nothing.
In act 3, scene 3 , Hamlet has an opportunity to kill Claudius while Claudius is kneeling in prayer. Hamlet is standing over Claudius with his sword in hand, but Hamlet hesitates, in order to give himself time to think about the situation. Hamlet talks himself out of killing Claudius, and tells himself that he's going to wait for a better opportunity to kill Claudius.
HAMLET. ... 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... (3.3.91-95)
Hamlet envies Fortinbras for his ability to make quick decisions, even frivolous ones, and to put those decisions directly into action. A captain of Fortinbras's army says to Hamlet, “We go to gain a little patch of ground / That hath in it no profit but the name” (4.4. 18-9).
HAMLET. Witness this army, of such mass and charge,
Led by a delicate and tender prince,(50)
Whose spirit with divine ambition puff'd,
Makes mouths at the invisible event,
Exposing what is mortal and unsure
To all that fortune, death, and danger dare,
Even for an eggshell. Rightly to be great(55)
Is not to stir without great argument,
But greatly to find quarrel in a straw
When honour's at the stake. (4.4.49-58)
Hamlet's single spontaneous act in the play, when he killed Polonius when Polonius was eavesdropping on Hamlet's conversation with his mother in act 3, scene 4, occurs far too late in the play to have served as a lesson to Hamlet to avoid making hasty decisions or acting impulsively.
Nevertheless, Hamlet's accidental killing of Polonius represents Hamlet's behavior throughout the play. Hamlet doesn't act. He only reacts. Every substantive action that Hamlet takes in the play is in reaction to something that some other character does.
Hamlet's impetus to finally do something to avenge his father's death occurs when Hamlet has only minutes to live. Hamlet decides, finally, to kill Claudius, but this, too, was a reaction to Laertes's dying words, "The King, the King's to blame" (5.2.328).
If Laertes hadn't blamed Claudius for Gertrude and Hamlet's deaths in the final scene, Claudius might well have outlived Hamlet.