A p trap is one of the fundamental elements of plumbing. They are very simple to visualize, and you have them under every sink or tub in your home. P traps exist because the house drain system is empty much of the time, and does not completely flush out human waste and other waste products out of the system. As waste decomposes the process releases methane and other flammable, stinky gasses.

Your house plumbing system is called a DWV system for Drain/Wastewater/Ventilation, and over each drain there must also be a riser that will terminate in a vent above the roof. The roof vent permits gas to escape You can tell a DWV vent from other roof perforations because they are open on top, as the drain pipes aren't worried about rain coming in.

But being gasses, those noxious fumes will vent where they can. So to ensure that your gasses stay inside the system and go to the roof plumbers install a P trap everywhere, except under your toilet, whose bowl itself serves as a trap.

The trap is very simple. Imagine a capital P letter, turned on its side so the fat part points down. as you run water through the sink, waste water will flow down into the p and back up down the stem into the DWV riser. When you shut off the sink a small amount of water remains trapped in the P, blocking the gasses. The water doesn't get rancid because you change it every time you run the faucet.

snaking through a P trap

Drains being drains, they will eventually clog, and it can be hard to get a plumber's snake through the trap. Under sink traps are easily removed with a pipe wrench or channel lock pliers. Put a bucket underneath to catch the water in the trap, remove and then snake down into the plumbing riser. To snake out a bathtub, the best way is to unscrew the handle that controls the drain, remove the cover and the drain rod. Insert the snake there to sneak past the trap and nail that clog. Then reinsert the drain rod, cover with lever and take that shower.

P traps are elegant devices. They are simple, nearly foolproof and keep the stink outside. They also catch wedding rings now and then. Which does much to improve the tranquilty of home.

lj tells me that in Britain and Australia a p trap is called a "u bend:".