
Sometimes, a character seems like a Houdini of Karma. However, certain circumstances and actions taken can result in the vicious retribution of Karma, related phenomena
Everything the villain has built up, piece by piece, comes crashing down in front of him. The lovebirds he kept apart pass by him arm-in-arm, the hotel he spent millions building catches fire and burns down, his former Yes Man steps on his foot, the bum he spat on now has a Rolex (probably the exact model he coveted) and asks him to light his cigar, and the dog he kicked is now laughing at him (or worse). People Come to Gawk at How The Mighty Have Fallen, and when one starts to laugh, everyone joins in. And here come the cops; turns out the mic was on when he declared his foul intentions.
In the end, the villain realizes he's in very, very dire straits. He's still alive, natch, but that's not all for the good.
This is very popular on kid's shows, as it's a way to ensure the villain is good and defeated without getting unduly violent.
Worth note is this isn't always that the villain can't die or doesn't deserve to, often times they could be killed but it just wouldn't be a fitting end for them. Sometimes death would just be the easy way out and is too good for the villain in question. The audience may be left feeling such a villain didn't get nearly what they deserved. Thus a well crafted defeat offers a satifying alternative. The villain is defeated, but they didn't get a demise. And naturally this makes sense, the more we hate the bad guy, the more we want to see him suffer. (Then again, sometimes the villain is killed at the tail end of his Humiliation, apparently on the reasoning that his degradation won't be complete until he's a rotting and dead.)
when this villian gets killed with about as much effort as it took to fight some of the tougher Elite Goons. Or the first level Warmup Battle. Either way, there was a lot of buildup, and was expected to be a tense, critical, epic battle ended up being a breeze. At the end of the story, it's not very epic, it can still be cool.
No matter how evil the villain is... the good guys can't just end them. They're supposed to be pure and noble (or innocent). Having them do it means they'd have to change genres and become Anti Heroes.
Having the villains just be arrested isn't as satisfying, either. Besides, they have the tendency to escape. Often, the villains are just too evil for such mundane measures. Plus, some part of the viewer wants Justice to be administered, but we don't trust human hands to administer it.
... so, the writers arrange for the villain to die in a manner that is completely their own fault. Or at least, not the hero's. Usually right in the act of attempting to kill the hero, for that extra irony.
Click Here to see what one of these defeats is like