One of the reasons Hamletis such a profound and interesting play is that a significant theme is acting. Among other themes, it is a play about acting. In particular, Hamlet and Claudius purposefully act in certain ways to affect others' behavior and/or to conceal their hidden agendas. Claudius acts in certain ways to conceal his crime. Hamlet acts in certain ways to conceal his motivations and plans for revenge. Claudius appears to be sorry about the death of the king but the reality is that he's not because, of course, he killed the king. Hamlet appears to be mad but in reality, he's conspiring a dramatic vengeance.
Fittingly, in a play about acting, Hamlet uses the travelling Players to put on a play depicting a murder. He uses actors, just as he himself acts, to expose Claudius' crime. This is perhaps the most famous instance of using a "play within a play."
I'll have grounds
More relative than this—the play's the thing
Wherein I'll catch the conscience of the King. (II.ii.603-605)
Hamlet is trying to "catch the conscience of the king." What he wants is to get a real, natural (guilty) reaction from Claudius.
Also in Act Two, Polonius utters the famous quote, "Though this be madness, yet there is method in't." (II.ii.206) Polonius does believe Hamlet is mad but he senses some method or some reason behind it. Polonius falls for Hamlet's act of madness but perceives a method beneath it.
Because of her father's death and the way Hamlet acts towards her, Ophelia goes mad. Hamlet's acting (appearance) is part of his grief and brooding, but it is also part of his strategy. Ophelia is one of the victims of Hamlet's "madness."