We all know that most fantasy stories aren't especially realistic. The real world is notably lacking in dragons, orcs, wizards and meddling gods, all of which are staples of the genre. Of course, those are all intentional bits of unrealism created to allow us to tell stories that couldn't have happened in Earth’s real history. But there’s a more subtle sort of unrealism that pervades the field, invisibly undermining the verisimilitude of otherwise well-written stories and bleeding incoherence into their deeper themes.
One common example of this is the issue of the Malthusian trap, or rather the fact that virtually all pre-industrial societies that practiced agriculture spent their entire history caught in it. This is something that experts have only really come to appreciate in the last few decades, and the implications don’t seem to have spread to the general public.
Briefly, the ‘Malthusian trap’ is the fact that in pre-industrial societies population growth happens faster than any feasible increase in food production. It takes years to build irrigation systems or terrace hillsides, and generations to get illiterate peasants to adopt a new farming technology. But the gains from such changes are relatively modest, and a population of poor farmers will grow quite rapidly if they actually have enough to eat. So the result is that once a society discovers agriculture it quickly spreads until all the land in the region that can be farmed with its current technology is under cultivation, and then the population continues to grow until starvation becomes common enough to keep it in check.
Let’s stop and think about that for a minute. We’re talking about civilizations where 95%+ of the population are illiterate farmers with no access to birth control. That’s a lot of starvation. By modern standards it’s an almost unimaginably brutal world. But this single realization explains countless examples of ancient behavior that would otherwise be inexplicable, while also closing off almost every way of improving the situation.
Why was life so cheap? Because even in a normal year there are people starving to death in every village in the country. So if someone dies working in the mines or fighting enemies on the frontier, that just means there’s now enough food for someone who was going to starve to death to live.
Why did legal codes make such free use of the death penalty? Because every criminal you kill is another honest citizen who gets to live. If you lock a criminal in prison and feed him you’re taking that food from the mouth of a needy peasant somewhere.
Why was infanticide so common? Because peasants didn't have birth control, and it was commonplace to find yourself with more children than food. Leaving an infant on some hillside wasn't easy, but it was better than keeping the baby and killing one of your older kids instead.
Why were sons more prized than daughters? Well, ok, there are several factors at work there. But a major one is the simple fact that the average woman eats 70-80% as much as a man but has barely half the upper body strength, and on a farm that modest loss of efficiency could often mean the difference between survival and starvation.
Why didn’t benevolent rulers use their great wealth to help their people? Because it doesn't work. Lowering taxes and helping the needy means fewer people will starve this year, but that just allows the population to grow. Keep it up for a few years and the population will expand until it overwhelms your resources, at which point the peasants will be back to living on the edge of starvation. At which point they’ll probably blame you for the change, and revolt.
All of this is important for fantasy writers, because it implies that the happy bucolic prosperity you see in so many recent stories is simply impossible. If the peasants of Happyville have warm, comfortable houses and plenty of good food that means every family is going to have half a dozen kids. A generation later you’ll have a lot more people trying to live on the same land, and everyone will be too busy trying to squeeze a few extra cabbages out of marginal bits of land to build nice houses or other creature comforts.
Having a few wizards wandering around doing small-scale magic on occasion doesn't change this brutal math, and even the wisest of immortal rulers will find no policy they can enact to change things. A strong government can to some extent decide who lives and who dies, by collecting taxes (usually as food) and distributing it to favored groups. But the population is going to grow until something stops it.
Now, there is one way to have a pre-industrial society where the commoners are prosperous, but it isn't much of an improvement. If something kills off a decent fraction of the population every few years that might be enough to arrest population growth before you get to the stage of constant near-universal hunger. But keep in mind that you have to kill women and children too, not just the men. A society can have a third of the men die in some distant war every generation with no effect at all on population growth - what matters is how many of the women survive to have children.
So how did we get out of this trap in the real world, if it’s such an iron law?
That’s an interesting question, but historians and economists can’t quite agree on an answer. The first part is clear enough - industrialization kicked off an era in which food production, transportation and storage all improved much faster than was previously possible, and actually got ahead of population growth for several generations. But after that some combination of social factors caused people in developed nations to start having fewer and fewer children, making it progressively easier for food production to stay ahead of demand. At this point people in developed nations have so few children that populations are actually shrinking, although the availability of reliable birth control for the last 40-50 years may have something to do with that.
What this all means for fantasy authors is that if you want to write realistic stories you only have a few choices. You can introduce industrial-scale magic that transforms society into something resembling modern-day Earth, but then you’ll end up with a story that looks more like SF than fantasy. You can impose some kind of universal birth control system far more effective than anything that has ever existed in the real world, but then the societal effects of that regime are inevitably going to dominate your story. Or you can pick a familiar medieval or ancient setting, and accept the fact that you’re writing about an incredibly brutal world where mass starvation is a daily fact of life.
...or you can retreat into urban fantasy, and spend your time writing about some Strong Independent WomanTM and her struggle to decide which sexy half-human alpha male she’s going to date. But that’s not the kind of story I’m ever likely to ever write.