In the decades following the Revolutionary War, opportunists from across the globe poured into New York City seeking fortune in the Capital of the newly formed United States of America.
Anticipating a major growth in population, the modern day street grid was established in 1811, opening up two-thirds of previously uninhabitable Manhattan real estate. As industry boomed, the city (perhaps conveniently) opened its doors to laborers, Irish and German immigrants, former Southern slaves, and down-on-their-luck job seekers.
Many successful families migrated north, away from the heart of the commercial and industrial districts and a class-structure emerged in New York City for the first time -- exemplified by this 1864 illustration:.
To give you an idea of how dense that is, today there is an average of about 70,000 residents per square mile in Manhattan.
Overcrowding eased up early in the twentieth century when the city subway system (1908), Williamsburg Bridge (1903) and Manhattan Bridge (1909) opened, allowing entire communities to relocate and move freely between Manhattan and the outer boroughs.