What was happening out in the countryside that made it so people found the conditions of the factories and cities preferable during the Industrial Revolution? What forced people to make the decision to endure life in the factories and cities?
Because it was not necessarily better in the country. If you were a landowner, or even a tenant farmer with a good farm, you might indeed have a better time of it than in a factory job. But an agrarian economy is limited by the amount of arable land. If you were the third son of the farmer or tenant farmer, you would be stuck in place as a farm laborer, and would have no chance to take over the farm: and you would not be able to easily get your own in a place like England. Also, although it seems pretty grim to us now, a large city or mill town presented more possibilities to a young worker. The rural world tended to have much fewer of them... the blacksmith might only need a hammerman and the likely lad might have to wait for the smith to die before he could open his own shop, as there wouldn't be room for two smiths in the village. The great house might have a need for a maid with good sewing skills, and receiving vails from visitors might help the likely lass build up a dowry, but she really would not be able to marry that likely lad unless he could get on as a smith, and might be stuck instead in the great house, sewing sheets and patching linens
Wages would tend to be higher in places where those rural workers could move on. This was the problem for mill owners in New England, when Francis Cabot Lowell built his first textile mill in Massachusetts. On one hand, he knew that Americans were far less likely to tolerate the abuse and exploitation found in English mills- they could always head west and look for better- and so made promises to have a paternalist working environment that would not hire children, paid cash wages regularly, provide regulated housing, and offer education. On the other hand, he cleverly identified a large untapped labor force- young farm girls. They were even less likely than boys to inherit family farms, would be lucky to marry the owner of one, weren't going to head west on their own and could be paid lower wages than men. And, because the spinning and weaving machinery was water powered, brute strength was not needed to make it go: girls would do as well as men.
But still: for the most part, Cabot's mills and US factories in general did not offer a real career- a factory job still tended to be hard and dangerous ( 80 hour work weeks, and tuberculosis easily spread among the Lowell loom operators). It's notable that in all the many optimistic rags-to-riches novels of Horatio Alger, none of his protagonists gets ahead working in a factory. You do wonder why more workers didn't stay away from them.
For Britain at least, people were basically forced out of the countryside for want of work.
The "agrarian problem", as EJ Hobsbawm calls it, was solved in Britain primarily by a series of Enclosure Acts (1760-1830). "Common" land was systematically sold to rich landowners. This meant that ordinary people increasingly could not use land for subsistence through farming or hunting- they had to work on someone else's land for money. Unlike most of Europe the idea of peasantry had been done away with relatively early. These large tracts of land could then be farmed more efficiently, as opposed to the "strip" farmers, who farmed just enough for their families. More efficiency called for less workers. Agriculture became something done "for the market" by a small number, as opposed for oneself.(1)
This meant that there was an increasingly large surplus of labour in the countryside. This was compounded by advances in agriculture such as the threshing machine, which again meant less workers were needed. Landowners took advantage of this and squeezed their wages as much as possible. This led to increasing levels of unemployment and poverty amongst rural populations. William Cobbett, journalist and later a reformist MP, detailed the suffering of the poor in the countryside in his Rural Rides. The inequality between the rich and poor became ever more stark, leading Cobbett to compare the disparity of the countryside to the state of France under the Bourbons. As he put it after one such ride in 1821: “Here dwell vanity and poverty.”(2)
Not all workers meekly moved to the cities though. Some took more direct action, and demanded higher wages. For example, In 1830 letters signed "Swing" began to threaten landowners who underpaid their workers, like this;
Sir,
This is to acquaint you
that if your threshing ma –
chines are not destroyed by
you directly we shall com –
mence our labours
signed on behalf of the whole
Swing
(3)
These were inevitably followed by rioting, barn burning and machine breaking, in Luddite style. Without exception these sorts of uprisings were crushed by the government, and when found the perpetrators were typically either hanged or transported to Australia.(4)
In short, many did not stay in the countryside because it simply was not a viable option- to stay would be the certainty of a life of grinding poverty.
(1): EJ Hobsbawm, The Age of Revolution 1789-1848, (p46-47).
(2) William Cobbett, Rural Rides, p40 (https://www.gutenberg.org/files/34238/34238-h/34238-h.htm)
(3) A letter to farmer Biddle (https://ageofrevolution.org/200-object/captain-swing-letter-to-mr-biddle-farmer-high-wycombe/)
(4) Hobsbawm and Rude, Captain Swing