How is satire used in Hamlet?
Satire is used primarily in Shakespeare's Hamlet by Hamlet to make fun of the people he doesn't respect. Hamlet is very intelligent and he doesn't like it when other people try to "play" him, or weasel information out of him. Hamlet is under almost constant interrogation in the play, though the interrogation techniques are usually not typical.
When Polonius spies on him in Act 2.2 Hamlet uses satire against him, calling him a fishmonger, and making the point indirectly that Polonius isn't honest (Polonius is in the process of spying on him). Hamlet says to Polonius:
Slanders, sir; for the satirical rogue says here that old
men have grey beards; that their faces are wrinkled; their
eyes purging thick amber and plum-tree gum; and that they(210)
have a plentiful lack of wit, together with most weak hams.
All which, sir, though I most powerfully and potently
believe, yet I hold it not honesty to have it thus set down;
for you yourself, sir, shall grow old as I am if, if like a crab,
you could go backward.(215)
Hamlet uses wit and humor to ridicule Polonius. That's satire, of course.
Another example is Hamlet's series of responses to Claudius when Claudius is interrogating him about the location of Polonius's body (this time expected methods are used) in Act 4.3. Hamlet ridicules the king, playing on his opening line about Polonius's body being where it is eaten not where it is eating. Worms eat the bodies of kings the same as they eat the bodies of beggars. Hamlet's wordplay leads to the conclusion that "a king may go a progress through the guts of a beggar." Claudius is the same as a beggar, king or not.
You could also look at Hamlet's slapstick comedy with Ophelia in Act 2.1, when Hamlet screams as if Ophelia's returning his letters and rejecting him have mentally destroyed him. Hamlet's playing the recorder and cynically asking Ros. or Guil. (I forget which, after all they are interchangeable) how he expects to play Hamlet when he can't even play a recorder is another example of Hamlet's use of satire.
The play as a whole is not a satire, of course. But Hamlet does use satire to ridicule those he views as enemies.