Political machines arose as a response to a need for welfare-type programs for immigrants and because the presence of large immigrant communities gave potential bosses a way to make sure that they could stay in power.
Machines were possible because of the large immigrant communities, which were mostly relatively poor. These groups needed help of the sort that the government could provide (city jobs, welfare payments) and could be mobilized pretty easily because they tended to be close-knit. This allowed the bosses to set up the "jobs for votes" deal that was at the heart of the political machine.
Machines were also possible because of the lack of "good-government" laws at the time. These types of laws were gradually passed and the immigrant communities dispersed as their members gained access to the middle class. This is what broke up the machines.