AKA the Neolithic Revolution*
To start off, hunter-gatherers were not stupid; it is highly unlikely
that humans did not know 'the secret of the seed' long before they started
farming. No one knows exactly why they started farming, but it may have been due
to population increase,** lack of wild edible foods, or just chance.
For whatever reason humans started doing it, they found that it was
addictive. Farming allows for a larger population, in part because of the
potential for increased food supply, and in part because you can have lots and
lots of children. In hunter-gatherer populations you have to carry young
children around with you, limiting your mobility. In farming societies you don't have this problem;
in fact, on the farm children can be a benefit at around age five,
helping out around the house (and, ironically, with child-care). It is also
possible that lactation acts as a form of birth control; hunter-gatherers tend
to breastfeed young children for the first couple years, because there isn't
much else for them to eat. Farmers can often feed babies ground grain
mush, freeing the mother from breastfeeding. This allows her to work on
other tasks -- and perhaps makes her more fertile as a side effect.
A larger population may not have the option of going back to
hunting-gathering, even if they wanted to, because the local ecosystem can't
support the enlarged population without the added food gained from farming.
To make matters worse, after a few generations people may start to forget the skills needed to survive
as hunter-gatherers.
One cool side effect of settling down is the ability to own more stuff.
Hunter-gatherers have to carry all of their possessions, and so make do
with as little as possible. For example, pottery tends to come
along with farming; this is probably not a coincidence. Pottery is a simple
enough idea, but it is heavy. Farmers also own land. Hunter-gatherers
sometimes own land, but it is not so common and is less enforced than it
tends to be in farming societies.
Once you have the idea of land ownership and a growing population, farming takes off -- you start working more land, you have more children, they start working more land, etc. Farming has appeared independently in multiple areas -- Asia, Africa, and the Americas, perhaps multiple times in each of these areas. While it may be slow to spread in any given area, in the end it nearly always takes over.
Eventually you get all the trappings: governments, state societies, money, the working class and the nobility, etc. But long before you get to the level of modern day Europe and America, one fact stands out above all others: Farming stinks. The shift from hunting-gathering to agriculture has been called the greatest mistake the human race has ever made. Disease goes up, nutrition is degraded, death rates may hold steady in some cases, but it often sky-rockets. For example, all of Europe until the 1800s was pretty awful.
One problem with agriculture is that it limits the variety of foods available to a population. Foragers get food from many different plants and animals, and thus are more likely to get all of the vitamins and minerals that they need. Farming societies tend to have higher rates of goiter, pellagra, xerophthalmia, beriberi, tetany, rickets, anemia, and other deficiency diseases. Another problem is that crops will sometimes fail, and when they do, people die. Hunter-gather societies tend to have many food sources to fall back on; this is true even in 'modern day' (i.e. last 50 years)
hunter-gatherer societies, which live in the most marginal environments there
are (the Kalahari Desert, sub-Arctic Canada). When farming was just beginning,
hunter-gatherers lived in many more friendly environments than they do now.
We get another twist when trade networks pop up; there are many modern day
examples of small farming populations trading nutritional foods needed for
their good health to other populations in return for 'luxury' goods (or rent
on their land, once real class societies get going).
This exacerbates another problem of farming societies: increased amounts of
pathogenic diseases. Hunter-gatherer populations tend to leave their waste
behind them when they move. Settled populations cannot do this. The waste
tends to attract vermin (like rats and insects), which spread
disease. Feces tend to carry parasites like tapeworm and hookworm (which
in turn prevent humans from absorbing all the nutrients they need, and add to
the deficiency diseases). This is often made worse when human waste is used as a
fertilizer. With higher population concentrations, contagious diseases become a problem; in a large enough
population, epidemic diseases can circulate. This doesn't
happen in smaller populations, because after passing through a population once
diseases like measles and smallpox leave all hosts dead or immune to
re-infection. If a large number of new hosts aren't entering the population
(usually thru new births), the disease will have no one to infect, and it
will die out.
And there are yet more problems with agriculture-based societies:
domesticated animals can act as reservoirs for disease, and sometimes diseases
of these animals will pass over into humans (the pox viruses and
influenza are believed to have originated in domestic animals); since there is
usually less breastfeeding, babies are more likely to get sick; changes in the
environment may cause diseases, for example clearing rain forests makes new
opportunities for the malaria-carrying mosquitoes to breed; and because there
are so many opportunities for disease any given individual may have a heavier
burden (more parasites per person).
But even before modern medicine stepped in to save us, settled populations
had some benefits, disease-wise. For example, settled populations are better
able to take care of the sick, while hunter-gatherers travel around. The movement of hunter-gatherers may have exposed them to multiple cases of diseases, in slightly different localized variations
(analogous to traveler's diarrhea). Settled populations may also have a
better chance to develop commensal bacteria loads, which help protect
them from some diseases, although this is in debate. Perhaps the most important effect of
having a large settled population is that epidemics are very powerful
weapons. If you have had an epidemic circulating through your population for a
long time, most individuals will be immune to it (having had it once, probably
while still young children). When you move into new areas, you bring the disease
with you, killing large numbers of the unexposed populations. This was of great
impact when Europeans came to the New World, and may have been significant on
a smaller scale in the distant past. (This would probably not have been an issue
until the event of state societies, because epidemics require 5,000 new
individuals per year, at a low estimate, to propagate.)
At best, agriculture was a mixed blessing. For the past 10,000 years it has been making lives miserable. It was not until the last ~100 years that it paid off for large segments of any population. On the bright side, if the current trend continues, the next 10,000 years look like they'll be great.
* 'Neolithic revolution' is probably more accurate than 'agricultural revolution', because the agricultural revolution didn't start with agriculture, but with horticulture. Neolithic refers to stone age farmers
who appeared here and there about 8,000 to 10,000 years ago. But this refers only to European cultures; in the Americas, farming started in the Archaic and early Woodland cultures, about 1,000 to 9,000 years ago. The Mississippian period is when farming really took off in the Americas, 1,000
years ago. So there is some justification for calling it the agricultural revolution, if you are talking about farming in all parts of the world.
** While population growth does come with farming, there is a long standing
debate about which came first -- do you farm because you have too many people to
feed by other means, or do you have so many people because you farm?
For much more, Health and the Rise of Civilization by Mark Nathan Cohen is a good, if long, book.