The basic idea of a drain is pretty simple. Water starts at the high end and runs, using gravity, down a trench or a pipe to the lower end where it flows out, into a sewer or ditch. Modern drains need three things to work properly — a trap, a stack, and a clean out. Here’s a little about how the drains in your house actually work.
All drains in your house lead to a sewer (or a septic tank in some cases). The trap on a sink drain is a curved piece of metal or plastic called either a “P” or an “S” trap, depending on their shape. The trap is designed to hold some water in its lowest section that blocks sewer gases from getting up the drainpipe and into your home.
Because of its shape, the trap also provides a useful function in trapping solid objects that might fall down a drain (like a ring). Traps can also trap solid waste causing a blockage in the drain that can usually be removed by opening the clean out on the bottom of the trap.
You clean out a trap by removing the screwed on clean out piece and allow water to run out of the drain. You now have access to the low end of the trap and can remove the blockage (or get your ring back). There is one part of a modern drain that is vital to its operations and yet many people don’t even realize it exists: the vent. While gravity will move water down a drainpipe, for the drain to flow smoothly air needs to get in above the water moving in the pipe. This is the function of the vent. It’s literally an open pipe that connects with other vents from all the drains in your house and runs out the top of your roof.
Vents are also a building code requirement since they allow gases in the pipes to escape (minimizing the chance for smells or even fire) as well as allowing wastewater to flow smoothly out of the drain by relieving air pressure.
If a drain vent isn’t properly connected, a drain will flow intermittently and water will "burp" its way out of the pipe. Many times an inexperienced DIYer will move or modify their sinks (and drains), not connect a vent, and then wonder why the sink won’t empty properly.
Toilet drains work on the same principle as sink drains, however they need water pressure to force water down the drain. This is because the high end of an integral “S” trap in a commode keeps water in the bowl until a toilet is flushed. The pressure of the water coming from a location higher than the high end of the trap forces the water (and waste) through the trap and finally into the soil/sewer pipe.
Since gravity moves waste water you might think as long as a drainpipe slopes downward from a fixture to the sewer pipe it will work just fine. However, too much slope can actually create a problem. Consider, if the slope is too great, water will quickly rush down a drainpipe and leave some solids in the pipe rather than carrying them along. Naturally, if solids remain in the pipe, over time they will build up and eventually cause a blockage.
Standard building code requirement for drainpipes is 1/4 inch of downward slope per foot of run.