Emptying chamberpots from upstairs window was a feature of city life from ancient Rome to the Regency. For centuries, urban streets served as open sewers. The infrastructure under your average medieval privy wasn't usually more than a pit. Even this yields fertile gaming ground. This is before plumbing and the fantastic elements of magic, monsters and other realities.
So, let's start with the one thing all have in common...
Night soilBefore the sewer came the humble cess pit or cess pool, positioned under or away from the dwelling. Buckets or chamber pots would be emptied by servants. Some ancient cultures relied on gravity to transfer waste to the cesspit. These pits were sometimes perforated to assist with drainage of liquids into the soil. The leaching into the soil could be a problem so placement was serious business. Too close to your water supply was fatal. Sobering thought when foraging for water near a goblin camp.
Where there's muck, there's brass.Over time, cess pits fill up. Night soil removal was antisocial yet lucrative. Often working at night, these rakers or night men used long-handled scoops and buckets to load the filth into barrels onto wagons for transportation to specific dumping grounds, certain river piers or marshes. Some took their cargo to nearby farms for fertiliser.
A night-time urban chase scene involving a dung cart is memorably nasty for those involved.
As late as the 14th century, stories of homes collapsing into cesspits underneath were recorded. This was not just a commoner thing. In 1183 at the Palace of Erfurt, the Holy Roman Emperor escaped death after a feast where many guests drowned in the cesspit. Ironic sequel was Richard Raker, a London cesspit emptier whose privy collaped sending him to drown in his work in 1326.
Something to consider if you explore abandoned ruins. Or a vile trap for the heavily-armoured.
Not everyone could afford to pay this service or for the protection that it needed. Gangs stoned night men or shot their horses as late as 1850 in New York if they weren't paid. Indiscriminate dumping was also a problem. Cities charged big fines for unauthorised dumping and beadles (church-sponsored or civic functionaries) supervised to keep the streets clean. Few faiths want diseased worshippers.
Religions with hygiene laws may be actively involved. Those acolytes must be good for something.
Sewers solving the problemSewers were intended to remove water (draining storm water or marsh) since Babylonian times and removal of waste was an incidental benefit. Ancient China, Babylon, Crete, Egypt, Greece, Pakistan, Palestine and Rome built infrastructure to support. Crete and Greece had sewer arches big enough to pass through. Rome delayed adoption partly due to privacy concerns! The Romans under Emperor Vespasian built public urinals. This (and a tax against urinating in public) kept Romans from fouling the stairs and collected urine for dye-making to boost the Emperor's coffers.
As with all ablutions, Romans made this social and gossip and intrigue could be conducted here. An enterprising ruler requires much wealth to provide this act of philanthropy. Or slave labour on demand.
Where medieval sewers were kept away from streets (not often in Europe) they linked up to irrigation channels and solid traps for people to farm for fertiliser. Tanners would hire people to bring pots of urine for coin. The practice of street vendors offering 'modesty cloaking' as a customer relieved themselves continued from Rome until the 17th century and later. Such vendors could learn many things. Toilets were decreed by law in France in the late 16th century though these would just feed back into chamber pots or earth closets.
The concept of privacy was nascent even then. Royal audiences could be conducted here as well as more sordid affairs and odd assassination attempts.
Sewer constrfuction boomed in the 19th century. Steampunk dungeoneers may clear out monsters by Royal Charter for sewer engineers. Later construction may inspire horror games. Public urinals made their comeback, initially in Paris and India. The industrial revolution and advent of rail mandated change. As long-distance travel became ubiquitous, the need for privacy and restroom aesthetics increased alongside them.
Magical solutions & monstrous opportunitiesThe sewer offers down and dirty dungeoncrawling with added risks of disease, noxious gases and dubious water supply linked to canal, marsh, river or sea. Medieval sewers existed but enclosed sewers that people could travel along were rare in the real world until the 19th century.
Magical societies may have avoided atavism and linked sewers to canals or irrigation channels. Magic may be used for sanitation, turning the sewage into something cleaner and more useful. Or it may transport it somewhere else. Altruistic cities will work on safe transit. Others may be less kind. Cloud castle cess pits are no laughing matter. Oozes as clean-up crew make sense if you stop them climbing out into unauthorised areas.
Such underground construction may be linked to cave networks. This would be a smuggler's paradise. If there were underground catacombs, the décor would be spooky and occupants may be undead or hangers-on. From such fertile roots may megadungeons spring. It may not just be water and waste in the cesspool. Alchemical wastes, wizardly experiments and unholy messes may alter the deal (and local residents) further.
Ecology of the sewerThis discussion is more interesting than some would have you believe. The community above determines how active and large the population is below. The primary influx of energy is waste matter, just over a quarter of a pound (128g) per human per day from excreta. Other sources of biomass are sometimes dumped into sewers, your call on how frequent and how much. About 10% of biomass produced supports life at each trophic level. The rest is lost to the messy business of living. So for a city of 40,000 (say like Middle Ages London, by no means the largest city) that's 11,200lbs of potential biomass per day in a one mile area.
First trophic level is a mixture of bacteria, detritivore (e.g. flies, millipede, ooze), decomposer (e.g. fungi, mold), omnivore (e.g. cockroach) and where the sun rarely reaches, autotroph (algae). About a half-ton (1,120 lbs) mean some sewers are lively even with flooding. As long as the food keeps coming they're happy. The higher levels won't starve.
Second trophic level includes larger detritivores, omnivores and primary consumers of the first trophic level. Bats, centipedes, frogs, rats, small fish, spiders. About 112 lbs per day keep near their food supply. Remember 9 out of 10 don't get eaten and most of these live more than a day. Active but barring unusual local species, below our consideration. Until something causes a swarm. More on that later.
Third trophic level are secondary consumers. About 11 lb of biomass makes this the apex predator. Maybe a few giant rats (for Princess Bride or James Herbert fans), a nest of vipers or a solitary, sewer-dwelling lynx. Other visitors are desparate wanderers. Bad food, poor water and plentiful disease discourage most. Yet in winter, many options are considered.
Water is poor-quality as decay deoxygenates water. This is mitigated by rain from storm drains. Fish and molluscs survive where water is cleaner but drinking isn't advised and shellfish will be contaminated. Disease is a real risk, your average bacillus ain't heavy and a teaspoon of Clostridium botulinus goes a long way. Beware brackish pools and fouled water. Higher trophic levels can also scavenge from the waste directly.
Definitions of edible and serving suggestions vary by species. Tweak towards interesting for your game.
Interfering with the ecologyRemember this is before adding other organic waste and missing persons. In a city of 40,000 souls, some will be evil. Medieval homicide rates were higher (about 0.5 - 1%) and the body must go somewhere. One person killed every day for a year is noticeable. A scientific guess of one body a week dumped down the sewer makes about an extra 20lbs of protein per day for the omnivores and detritivores. Now imagine how a serial killer or discreet murderhobo changes things.
Missing folk and an explosion of vermin may raise questions. Particularly if plague comes calling.
The vampire or wererat nest in a sewer is classic. Imagine Welles' The Third Man with wererats? Now add those swarms mentioned earlier. Constructs may work tirelessly to stop blockages. Elementals may be twisted by this environment. Outsiders and otherworldly monstrosities may adopt a sewer for their own bizarre purposes or perhaps in memory of home.
Undead may depopulate or shift the ecology. Ghouls may be a problem if there's linked catacombs.
Speaking of scavengers, fungoids, rat-folk and other carrion crawlers may find the sewers ideal. More mundane monsters may include big snakes, crocodiles and octopoid monsters like sewer squid or darkmantles. Oozes and slimes are obvious clean-up crew, quite a few climb and squeeze through tiny openings. An amorphous self-cleaning killer may be tricky for investigative types.
...to another is treasure!Scavenged loot may be taken magpie-like by sewer dwellers. It may be hastily discarded. It's not likely to be the wealth of ages. Yet the oddest things have a way of ending up down there. It's more likely loot is incidental and small. Stories and rumours may say differently. While a dragon's hoard is unlikely down here, it's not an obvious hiding place is it?
As with everything, history trumps the fevered imagination. Keeping it primitive may boost grimdark quotient and Rabelaisian bawdry. Magical sewers require an interesting backstory. The who, why and when matter. The threat of disease, monsters and worse (the smell!) motivates heroes or profiteers. It may also motivate villains. Plenty for a GM to work with.