Evolution is a game of reproduction, as (nearly) everyone is aware. “Fitness” isn’t about being “more fit” as we usually think of it when considering whether someone is faster, or stronger, or smarter; it’s strictly about contributing the most genetically to the next generation, and the generation after that. Someone who has more children is more fit than another who doesn’t; someone who has more grandchildren, fitter still, since those children have to become reproductive themselves in order for the genetic contribution to be relevant.
The most basic way to do this, and the way in which we are most comfortable thinking intuitively about evolution, is simply to have as many offspring as possible. Produce lots and lots and lots of gametes, arrange big mating events so that as many possible gametes wind up fertilized, do it again as often as possible- most of them will be lost, but some will survive to reproduce themselves, and the lineage will continue. This is the route that most plants and insects, as well as some fish and amphibians, take; all energy goes into volume. It’s not sophisticated but it works.
The next innovation from this is the idea of investing more in offspring so that there isn’t as much energy to have so many, but each one is more likely to survive and become reproductive itself. This is what fruiting plants do- it’s expensive to create structures full of sugar and other goodies, but doing so around a seed is a good way to get animals to plant seeds packaged in fertilizer somewhere relatively far from the parent plants, which give each seed far better odds than simply relying on wind and rain to plant a few seeds somewhere viable.
For animals, the first step down this path is giving eggs more than just the gamete and some rudimentary environmental protection; package each egg with a yolk, a bolus of rich nutrition that the offspring can use to grow to a larger and sturdier, and more developed, state before emerging and risking itself in the world. Yolks and other investments in the egg* are expensive relative to the more basic model, so clutches are smaller, but a greater percentage of offspring survive and so the investment gives a return.
If being able to lay an egg that is not so fragile and is pre-loaded with good nutrition is a decent investment in an offspring’s chances, a step above that is to actually protect and develop your offspring within your own body, with a direct line to nutrition- a step that all mammals and a few fish, reptiles, and amphibians take**.
Mammals, specialized in livebearing, continue the idea of protecting and investing in offspring by giving them milk: even after the offspring emerge, they continue to protect and nourish them until they are further developed. The more a creature can extend the period of protected and nursed development, the larger and more complex it can afford to become- the advantage of later development before independence can be turned into long developments to support bigger and more complicated brains and bodies. A larval stage can only be so much of a shortcut.
The next step in investment is parenting; not all organisms that parent are livebearers, but all of them put enormous amounts of time and energy into protecting a smaller number of offspring relative to simply reproducing. Parenting can range from simply protecting the offspring during a lengthy period of necessary development outside an egg or its parent’s body***, to feeding and educating it for years before it leaves for adult independence. In social animals, “independence” may not even be the correct term as normal adulthood involves a community arranged around mutual benefit.
As so often happens in evolution, over time something that was merely an advantage, if it is a sufficient advantage, may become a structurally integral necessity: for many organisms, especially the larger and brighter ones, parenting has become extremely involved and not remotely optional for successful reproduction. A baby songbird, horse, wolf, or child doesn’t just need its parents’ food and protection, it requires extensive education in how to survive and reproduce as a member of its species in order to have any chance at all of functioning as an adult. Complex behaviors give their owners greater adaptability, but they also can’t be simply bred in; parenting organisms gave each of their offspring major advantage individually, but they also transferred the bulk of their own investment from having sex and producing gametes to raising the results.
Humans are perhaps the most extreme example on the planet: human mothers spend nine months incubating an offspring as long as it’s still possible to pass through the pelvic opening, then give birth to an infant that’s extremely underdeveloped compared to even other mammals at the time of birth, which will spend more than a decade with its parents before even being physically capable of reproduction, during which it will continue to develop. They require extraordinary care on every level, and will never develop many key features necessary to becoming a normal member of their species- such as language- without care and interaction from adults.
An absolute hard minimum of 12-13 years is a long time to spend on investment in a single offspring, if one is alone, but under normal conditions humans never are. (Nor are many other social species with offspring with high parenting requirements, for that matter.) Parents aren’t the only ones contributing- their relatives and friends do, as well as the oldest among the children, so that more children than just the one can be fit into the same period. It requires major investment on the part of everyone involved, but everyone benefits at least somewhat, either through the most obvious direct genetic fitness payoff or in the form of reciprocity for their own offspring.
Humans are also long-lived, and women in particular live for decades beyond their own reproductive capacity. Why this is so remained a puzzling mystery for a long time- why would it benefit any animal to stop reproducing long before its actual life was over? In the most direct intuitive logic of fitness, why wouldn’t it be more fit to spend as much of your life possible reproducing?
The logic of investment responds: because with an animal this dependent on parenting, investment in offspring is neither restricted to your actual direct offspring, or to your physical capacity to impregnate or give birth. Long lifespans put an individual’s ability to influence its own fitness directly into reach, and across generational lines. The “grandmother hypothesis” is the idea that our long childhoods produced an equally long adulthood- with so much of a young human’s success influenced by direct care, with care by the actual parent not being a necessary part of the equation, a human’s reproductive investment need not end with their actual physical capacity to reproduce****.
More than that, a long-lived animal that lives in social groups has another advantage: having individuals within the group that are capable of productively reacting to infrequent but regular events. For a population living on a coast, supporting older, nonreproductive, and less physically capable individuals can have a very high fitness payoff indeed if some of them know what it means when the tide goes all the way out. Nor is such advantage absent from other long-lived social species.
Inclusive fitness: not just for bees. And sometimes your fitness relative to someone else’s has a lot less to do with how fantastic your genes are than it does with how much family you have that likes you.
*There are other reasons to lay complicated expensive eggs, like “being terrestrial”, but fish have a huge diversity of reproductive strategies even without this- the range of volume-versus-investment is present even without the necessity of eggs being able to survive out of water.
**A step that seems to have emerged completely independently for these latter three groups multiple times over, accomplished in varying ways.
***Notice I didn’t say “mother”. A male seahorse is using the same strategy, just taking a different way around the barn.
****Whether menopause happens because childbirth gets increasingly risky for the mother the older she gets, and therefore her fitness interests tip from having more children to looking after the existing ones, or because female great apes are only born with so many eggs and it’s simply living longer than our eggs last that’s the innovation, is open to debate.