It's not so much as actual trapping but more of a lose lose situation. Even if it's a neutral or resisted, damage is damage so there's that. I'll use an example where pursuit trapping is so prominent
Imagine a gen five ou game where there's the usual Latios and Tyranitar. Latios kills something with draco meteor and now, Tyranitar comes in. Latios doesn't want to stay in on Tyranitar so it has to switch ou but if it switches out, it dies. It stays in, it dies. Another good example would be a choice locked Lele locked into psychic in gen seven. It obviously can't touch Tyranitar so rather than wait to punish them the next time around, you just deal with it then and there. It's not in the usual sense of trapping where you have Heatran magma miss or Wobbuffet arena trap. It's more along the lines of punishing them for switching out.
Against neutral or resisted hits, unless you really know what's coming in, it's usually a good idea to punish them for switching out as a parting gift. A good example of resisted pursuit trapping, and one I did a lot, was trapping Greninja. If it locks into dark pulse, I switch in Tyranitar and eat half its life as it runs away. Now, the next time Greninja comes in, it would be at half hp
Technically, pursuit doesn't trap, like at all. The term was just coined as switching in is usually a preferred option as you take massive damage for switching out and it limits what a Pokemon can do, especially choice locked ones. Think of it like you're in a burning building and the only way out is thru a window that's on fire. No matter what happens, things are looking ugly for you
If you want a more detailed explanation, here is a video that explains pursuit a lot better than I can