The main feature of a trap, such as the U-bend (invented by Thomas Crapper in 1880), is that it holds standing water which prevents sewer gases from entering buildings from the drains, but allows waste to pass through into the sewer system.
After a toilet, sink or bath etc. has been used, the ‘trap’ (a P-, S- or U-bend) retains a small amount of water so creating a seal that keeps gases in the drains. All plumbing fixtures must be equipped with either an internal or external trap.
Traps also serve to stop objects accidentally dropped, such as jewellery, and collect hair and other debris. Most can either be dismantled for cleaning, or have a cleaning access point.