Booby trap
Etymology: The Spanish word bobo translates to "stupid, daft, naïve, simple, fool, idiot, clown, funny man, one who is easily cheated" and similar pejorative terms. The slang of bobo, bubie, translates to "dunce". Variations of this word exist in other languages (such as Latin), with their meaning being "to stammer".
In approximately 1590, the word began appearing in the English language as booby, meaning "stupid person, slow bird". The seabird in question was the genus Sula, with their common name being boobies. These birds have large flat feet and wide wingspans for marine habitats but are clumsy and slow on shore making them easy to catch. The birds are also known for landing aboard seagoing vessels, whereupon they have been eaten by the crew.
The phrase booby trap originally applied to schoolboy pranks, but took on its more serious connotation during World War I.

Military booby traps: A military booby trap is designed to kill or injure a person who activates its trigger, or employed to reveal the location of an enemy by setting off a signalling device. Most, but not all, military booby traps involve explosives.
Part of the skill in placing booby traps lies in exploiting natural human behaviors such as habit, self–preservation, curiosity or acquisitiveness. A common trick is to provide victims with a simple solution to a problem, for example, leaving only one door open in an otherwise secure building, luring them straight toward the firing mechanism.
An example that exploits an instinct for self–preservation was used in the Vietnam War. Spikes known as punji sticks were hidden in grassy areas. When fired upon, soldiers instinctively sought to take cover by throwing themselves down on the ground, impaling themselves on the spikes.
Many purpose–built booby–trap firing devices exist such as the highly versatile M142 universal firing device (identical to the British L5A1 or Australian F1A1), or Yugoslavian UMNOP-1 which allow a variety of different ways of triggering explosives e.g. via trip wire (either pulling it or releasing the tension on it), direct pressure on an object (e.g. standing on it), or pressure release (lift/shift something) etc.
Most explosive booby traps use between 250 g and 1 kg of explosive. Since most booby traps are rigged to detonate within a metre of the victim's body, this is adequate to kill or severely wound.

Effects: Booby traps are indiscriminate weapons. Like anti-personnel mines, they can harm civilians and noncombatants during and after the conflict. The use against civilians is prohibited by the Protocol on Mines, Booby-Traps and Other Devices, and the protocol also prohibits boobytrapping e.g. the wounded or dead, medical equipment, food, and drink.

History: A type of booby trap was referred to in an 1839 news story in The Times.
During the Vietnam War, motorcycles were rigged with explosives by the National Liberation Front and abandoned.  U.S. soldiers would be tempted to ride the motorcycle and thus trigger the explosives. In addition, NLF soldiers would rig rubber band grenades and place them in huts that US soldiers would likely burn. Another popular booby trap was the "Grenade in a Can", a grenade with the safety pin removed in a container and a string attached, sometimes with the grenade's fuse mechanism modified to give a much shorter delay than the four to seven seconds typical with grenade fuses. The NLF soldiers primarily used these on doors and attached them to tripwires on jungle paths.
The CIA and Green Berets countered by booby trapping the enemy's ammunition supplies, in an operation code–named "Project Eldest Son". The propellant in a rifle or machine–gun cartridge was replaced with high explosive. Upon being fired, the sabotaged round would destroy the gun and kill or injure the shooter. Mortar shells were similarly rigged to explode when dropped down the tube, instead of launching properly. This ammunition was then carefully re–packed to eliminate any evidence of tampering, and planted in enemy munitions dumps by covert insertion teams. A sabotaged round might also be planted in a rifle magazine or machine–gun belt and left on the body of a dead NLF soldier, in anticipation that the deceased's ammo would be picked up and used by his comrades. No more than one sabotaged round would be planted in any case, magazine, or belt of ammunition, to reduce the chances of the enemy finding it no matter how diligently they inspected their supplies. False rumors and forged documents were circulated to make it appear that the Communist Chinese were supplying the NLF with defective weapons and ammunition.

Northern Ireland: During the Troubles, an ethnonationalist conflict in Northern Ireland, booby traps were used by Irish republican and Ulster loyalist paramilitaries to target British security forces and civilians. The Provisional Irish Republican Army (IRA) was the most prolific user of the booby traps during the conflict; according to the Sutton Index of Deaths, 180 people were killed during the Troubles as the result of booby trap bombs, the vast majority of them laid by the IRA. A common type of booby trap was the car bomb, which involved attaching a bomb to a car so that starting or driving it would detonate the explosive.

Middle East: During the Al-Aqsa Intifada, some Arab–Palestinian groups made wide use of booby traps.
The largest use of booby traps (between 2000 and 2005, the period of the Intifada) was in the Battle of Jenin during Operation Defensive Shield where a large number (1000–2000 according to Palestinian militant captured in Jenin during the battle
) of explosive devices were planted by insurgents. Booby traps had been laid in the streets of both the camp and the town, ready to be triggered if a foot snagged a tripwire or a vehicle rolled over a mine.  Some of the bombs were huge, containing as much as 250 lb (110 kg) of explosives. To counter the booby traps, anti–tank and anti–personnel mines the IDF sent armored D9 bulldozers to clear the area out of any explosive device and booby trap planted. The IDF D9 bulldozers were heavily armored and thus did not sustain any damage from the explosions, which were triggered by them as they pushed forwards.
Eventually, a dozen D9 bulldozers went into action, razing the center of the refugee camp and forcing the Palestinian militants inside to surrender.

Gallery: 

Civilian use and legal ramifications: Booby traps have been applied as defensive weapons against unwelcome guests or against non–military trespassers, but most jurisdictions consider the practice illegal.

Practical jokes: Instead of being used to kill, maim or injure people, booby traps can also be used for entertainment. Practical joke booby traps are typically disguised as everyday items such as cigars or packets of chewing gum, nuts or other snack items. When the victims attempts to use the item, the trap is triggered. Two of the best known examples of this are the exploding cigar and dribble glass; others include the Snake Nut Can and shocking gum. Booby traps can also be constructed out of household or workplace items and be triggered when the victim performs a common action. Examples of this include loosening the bolts in a chair so that it collapses when sat upon, or placing a bucket of water on top of a partly open door so that when the door is fully opened, the bucket tips onto the victim.

See also: 

References: 

External links: US Army Training Film from 1944 (humorous cartoon with a serious message)
Mines & Boobytrap devices - British guide dated 1943
How not to get caught by mines and boobytraps – US warning guide dated 1944, and still relevant
How not to get caught by Vietnamese boobytraps - US guide dated 1969
Army Field Manual FM531 Boobytraps - US guide dated 1965
Photos of booby trap devices used in Angola
Booby trap concepts and detection techniques
The Straight Dope: What's the origin of "booby trap"? Archived 2008-11-20 at the Wayback Machine
Photos of injuries inflicted by explosive boobytraps (Warning: graphic images)
The M142 multi-function boobytrap firing device (technical specifications) Archived 2010-09-28 at the Wayback Machine
Cut-away diagram and technical specifications of M5 pressure release boobytrap firing device
Photo of M5 pressure release boobytrap firing device connected to a one pound block of TNT explosive Archived 2021-04-03 at the Wayback Machine
Paolo Borsellino's road side bombing triggered by a booby trapped door bell