Hamlet's encounter with the players is very important to the advancement of the plot as well as the revelation of Hamlet's character. When he first speaks to them, it becomes clear that he knows them personally, which is interesting because that means that a royal subject is associating with a group of actors. Actors were considered a rather lowly and unsavory group in those days. Hamlet asks them to set up an impromptu performance of a play he saw them perform only once, but he delivers the first 25+ lines of one of the monologues, thus illustrating Hamlet's interest in theatre and his intelligence. The choice of play is not an accident. He picks a play about a son who needs to avenge his father's death and at first delays, but ultimately kills his enemy. This clearly reflects Hamlet's life at this point in time.
Hamlet plans to have the actors perform a play that he revises to better match the death/murder of King Hamlet. He reveals in the soliloquy at the end of the act that he hopes to "catch the conscience of the king" by watching Claudius's reaction to the re-enactment of his foul actions. The players have provided Hamlet with an opportunity to get the proof he needs to confirm the ghost's story. Hamlet will not act against Claudius without proof for fear of damning his soul with an unjust act.
The last thing the players do for Hamlet is remind him that he isn't fulfilling his father's request. He is thoughtful at the realization that these actors seem to show more emotion for something that is not real to them than Hamlet shows for things that are very real. Hamlet's depression reveals itself again, but the plan with the players keeps him motivated to move forward with his ultimate quest for vengeance.