First off, distinguish storm sewers from sanitary sewers. The oldest systems still have them flowing into a single system, but they are rapidly trying to replace all such systems. Storm sewers, of course, simply take runoff from rain, snowmelt, etc., and route it into the appropriate drainiage, usually a stream or river.
At one time, sanitary sewers often emptied directly into rivers and streams, which diluted the sewage and processed it by aeration, fragmentation, and absorption of particulates in the course of its flow.
Individual plumbing, shared systems, and the smallest of community systems will feed into a septic tank and leach field, which allows for natural decay of the organic parts of the sewage and then its spreading into the subsoil, which finishes the purification process by absorbing water and nutrients.
Typically, community systems flow into primary, secondary, and tertiary treatment facilities, the level of sewage load mandating whether the latter units are needed. At minimum, there will be an aeration pond, gently agitating the sewage to encourage oxygen to enter it and feed the bacteria and such breaking down the organic wastes, and then the results will be processed through a large sand filter area before being fed into a stream. In larger communities, processing may need to be far more complex than this, and design and construction of such treatment facilities is a major aspect of civil engineering businesses.
Normally, sewer laterals and mains themselves are built at a very slight incline off the perfect horizontal, to permit downhill flow of the sewage. These are gravity sewers. Where this is not feasible, individual home or neighborhood “grinder pumps” or “injection pumps” are installed, which pulverize solids and lift and pump the result down force mains. These are typically of smaller dimension than gravity sewer mains, into which they typically empty, and are slightly pressurized by the output of the pumps.