Hamlet uses the device of having some traveling players present a play to the court so that he can check for himself if Claudius is in fact guilty of having murdered Hamlet's father. Hamlet rewrites and adds a segment for the players. When they present the play to the court, Hamlet closely studies Claudius to see his reaction.
The short presentation involves a King and Queen who marry hastily after a murderer pours poison in the ear of the Queen's husband, the rightful king. Of course Claudius bolts from the room quite upset, and Hamlet and Horation know that they have caught the guilty mouse in their trap.
It is extremely important to Hamlet to know for sure whether Claudius is in fact the murderer of his father before Hamlet takes his vengeance. Much of Hamlet's indecision has come because he is not 100% sure of the murderer's identity. He doesn't trust his own instincts and needs conclusive proof.
(This is similar to Dexter, if you watch Showtime. Dexter will only murder serial killers who he knows without doubt are guilty of their crimes and have escaped punishment by the law.)