To pin a piece against a king is pretty easy.
Let's use the Queen as an easy example. You place your queen in a way that the opponent is unable to move the piece in between their King and your Queen as it will place them in Check.
A simple move would be to get your King Pawn out of the way and then move your queen diagonally in front of your King. From there, your opponent's pawn would be pinned between your Queen and their King. There are innumerable ways to go about this move and if you play enough games, you're all but guaranteed to get this. I got it without even trying.