@AlainBertaud2 highlights a puzzle about slums:
While slums are VERY DENSE in terms of people living per square foot of FLOORSPACE,
slums are NOT DENSE in terms of people per sqft of LAND
Why is that?
You can see what Alain means in this picture I took as I was flying out from Mumbai to Addis Ababa a few years ago. The areas with blue roofs are slums.
The answer is that the land slums are on is so low quality, it would not be economical for a developers to build a taller building there.
Usually it is low quality b/c it's prone to floods or landslides, or close to nuisance like garbage dumps.
Why aren't tall buildings located on low quality land? Because building taller building are expensive, and people value land quality. So for developers to cover their costs of building up, they need to be on high quality land that people are willing to pay for.