how is shakespeares play within a play a method used to advance the plot?
Hamlet engineers the play-within-a-play to "catch the conscience of the king."
The play-within-a-play is a pivotal scene in the play because it provides Hamlet with the evidence he needs to proceed in his mission to avenge his father's murder. Hamlet has been determined to fulfill his father's request, but his sense of morality and his careful nature haven't allowed him to act impulsively. He knows that the ghost may have been in a devil in disguise, so he felt obligated to find proof of Claudius's guilt. During the play-within-a-play Hamlet has a running commentary on the action and makes sure that both Claudius and Gertrude are tuned in to the action. Claudius is suspicious and uncomfortable while watching a story that so closely matches his own life's circumstances -- he even asks Hamlet about the title of the play. Once the poison is poured in the ear (a rather unusual detail) Claudius abruptly leaves the stage -- the trap had been set, and it sprung on Claudius. The actual title of the play is The Murder of Gonzago -- Hamlet changes the title to The Mousetrap because that is what the play really is -- a trap to catch a mouse. Cats like to play with their prey before they kill it -- kind of like Hamlet is behaving here.
After the play, Hamlet is a new man. His sense of energy and eenthusiasm for the task of vengeance are renewed. He now knows that his actions will be justified. This is a very freeing feeling for him. Unfortunately, circumstances get in the way of action, and ultimately, Hamlet ends up a victim of Laertes and Claudius's deadly duel plan.