Fortinbras is presented in the play as Hamlet's foil. This means that he is a character that embodies everything that Hamlet is not. Hamlet himself is aware of this. While Hamlet feels compelled to avenge his father's murder, he is plagued with indecision, and this leads him to delay taking action. On the other hand, Fortinbras is brave and decisive, and he is not scared to die in order to regain his father's holdings. Hamlet admires this attitude, and this is the thing that motivates him to be different and become more bold and decisive.
Hamlet sees Fortinbras and his troops--twenty thousand soldiers--ready to lay down their lives for a plot of land that means nothing to them. When he sees this he realizes that if so many men are willing to die for something basically worthless, he is even more of a coward than he thought because he won't even fight to avenge his father's murder. He becomes disgusted with himself in his soliloquy at the end of this scene and vows to take action. This is Hamlet's major shift in the play: he says, at the end "my thoughts be bloody, or be nothing worth", and from this point on in the play he becomes more ruthless (getting Rosencrantz and Guildenstern killed to start) and goal-oriented towards killing Claudius.