What led to the massive amount of migration from farms to cities?
The process of populations moving from rural areas to the cities is referred to as urbanization. Urbanization generally occurs when a society moves to an industrial economy from a traditionally agrarian one. The reason that industrialism and urbanization have such a strong correlation has to do with the law of supply and demand applied to labor.
Industrialists build factories where there is a surplus of unskilled labor. This is generally found in the high populated areas of cities. Cities also have transportation and communication networks that may not be available in rural areas and which make it easier to get goods to market. As industry initially succeeds in the city, a larger demand for labor occurs.
When societies become technically advanced enough to mass produce goods in factories, agricultural technology usually improves in a similar way. This makes the process of producing agricultural goods more efficient. This means that farms can produce more goods with less laborers. This creates a labor surplus in rural areas.
When you combine the labor shortages that exist in the industrial cities with the labor surplus in rural area, the perfect demographic and economic solution is to have laborers move to the cities to secure jobs in industry.