Wastewater systems are a modern miracle. Here’s how they work and how they can be made better.