How to solve trapped piece puzzles
Bishops and knights get trapped most often. A bishop that grabs a pawn on a2 or h2 can be shut in by a pawn move. A knight on the edge of the board has few squares, so one or two well-placed pieces can cover them all. Even queens get trapped when they go pawn-hunting deep in the enemy camp.
To find these puzzles, look at the enemy pieces that have strayed far from home or onto the edge of the board. Count their safe squares. If there are only one or two, ask which move covers them, then whether you can attack the piece before it gets out.
In your own games, the same thinking stops you from losing pieces. Before you grab a pawn with a bishop or jump a knight to the rim, check how it will get back.