When teaching kids how to trap an opponent’s pieces, and not get their own trapped, I start with a very simple example:
Here White is able to win the pawn it is fixed on d5; in other words the pawn is not mobile. The same can be applied to a piece, and here is the most common example:
The knight is less mobile than other pieces and so it is very easy to trap it like this. To promote better understanding we ask kids to play a game where one has only knight and the other has a queen, the winner being the one who can trap the knight in the least number of moves. In a nut shell, if you can hamper or restrict opponent piece mobility there are more chances that you can win that piece.
A common way to trap a piece is by shutting it in with an obstructing piece. This often happens in practice, here’s an example with Black to move:
Here it would be a mistake to capture the g2 pawn because of Bg3, and white will win a rook on his next move. Of course I am not including any points like trapping the opponent’s bishop inside his pawn chain as it is not relevant when you first teach kids. It is very hard to trap a queen but this position often arises while playing against the French Defence.
Though I am not winning the queen here I am creating such threats that I can win some material. Capturing pawn on b2/b7 is also known as poisoned pawn variation in some openings.