A deathtrap is a literary and dramatic plot device in which a villain who has captured the hero or another sympathetic character attempts to use an elaborate and usually sadistic method of murdering him/her.
It is often used as a means to create dramatic tension in the story and to have the villain reveal important information to the hero, confident that the hero will shortly not be able to use it. It may also be a means to show the hero's resourcefulness in escaping, or the writer's ingenuity at devising a last-minute rescue or deus ex machina.
This plot device is generally believed to have been popularized by movie serials and 19th-century theatrical melodramas. A well-known example is the cliché of the moustache-twirling villain leaving the heroine tied to railroad tracks. Its use in the James Bond film series and superhero stories is well known.
It is a common criticism that it is unbelievable in story plots to have villains try to kill the heroes in such elaborate ways when they could use simple methods like shooting them. Through the decades, comic book writers have responded to these complaints by devising ways in which the deathtraps have served other purposes.
For instance, one Legion of Super-Heroes story by Jim Shooter had a team of Legionnaires put into a variety of deathtraps and the villains wanted the heroes to successfully escape. This was because the real purpose of the deathtraps was to have the Legionnaires use a great deal of energy doing so, which the villains then harnessed for their own benefit. Other stories have had villains use deathtraps as a means of testing the heroes or to distract them while the villain attends to other matters. On some occasions, the deathtrap is a machine that "absorbs" the energy from the hero/heroes.
Another rationalization for a deathtrap is when a particular villain simply enjoys leaving his victims some small chance of survival, just for the sake of sport. Such "sporting" villains include the Riddler, who has an uncontrollable compulsion to create intellectual challenges for his enemies. Also included in this list is the Jigsaw Killer, who places his victims in life-or-death situations to prove that they appreciate life. The Joker and Arcade are other villains who simply enjoy the challenge.