Why Do Cities Exist?

You might have lived in a city your whole life, or moved to a city from somewhere smaller, or visited a bunch of cities, without ever pondering this question: why on Earth do these monstrous places exist at all?

These sort of questions can be considered on a philosophical scale, or in terms of social sciences, or through a cultural lens... but eventually, like so many topics, it eventually gets eaten up by the monster of Economics.

The question really boils down to: How are cities economically viable? Are they a drag on the economy or a benefit? Why