I'm spending a week in La Jolla, CA, USA, about 15ft above sea level and I'm wondering where the sewage goes? There's no room between here and the sea for a treatment plant. There's pretty big apartment complexes and hotels that would need enormous septic tanks. How does it work?
The answer is that it is there you just don't see it. Like for example NYC has Tallman Island and an underground one on the West Side. It also depends on what exactly are you dealing with. For ground water (that little stream you might see by the beach) there might be a tiny treatment plant that dumps what is processed into the ocean. Bradley Beach NJ has one of those.
As others have pointed out pumps are a thing. In some situations you can do a degree of preprocessing before it hits the mainlines.