The simple answer – the entire Industrial Revolution!
The grand migration began with the surrender by Mexico, which took place on September 17, 1847. The Treaty of Guadalupe Hidalgo, signed in 1848, ceded the territories of California and New Mexico (which included the states-to-be of Utah, Arizona, Nevada, New Mexico, and parts of Colorado and Wyoming), and swelled to a flood with the discovery of gold in California and silver in Colorado.
Meanwhile, back home, immigrants continued to pour into New York and many other eastern cities. The government hired many of them to help build the Erie Canal, and of course, the Government fought the Civil War, between 1861 – 1865. The trans-continental railroad was built to ensure the safe transport of gold from California to the US government to help finance the war.
While it was not as exciting as the stories presented by Mark Twain and Horace Greely (“go West, young man, go West”), this is what wikipedia has to say:
“The new European immigration brought further social upheaval, and old world criminal societies rapidly exploited the already corrupt municipal machine politics of Tammany Hall, while local American barons of industry further exploited the immigrant masses with ever lower wages and crowded living conditions. In a city of tenements packed with cheap foreign labor from dozens of nations, the city was a hotbed of revolution, syndicalism, racketeering, and unionization. In response, the upper classes used partisan hand-outs, organized crime groups, heavy handed policing and political oppression to undermine groups which refused to be coopted. Groups such as anticapitalist labor unions, native American patriot organizations such as the American Protective Association, and reformers of all stripes were fiercely repressed, while crime lords that became too independent disappeared.”.