Doing some research into it, I think I've figured out the military service one. But first, an even more outrageous screenshot:
I built 7 Warriors while my city was at population 7 (thanks to a tax collector/scientist). When my city grew to size 2, the military service fell to 35 years. I had to disband two Warriors, taking it down to 25, and then my city grew to size 3, the military service fell to 16 years.
So, I believe the formula is:
Military Service = floor((militaryUnits * 10)/cityPopSize)
Where city pop size is the size of your cities in terms of # of citizens (on the map, not the Pop figure in the city screen).
Life Expectancy is at a minimum 20 years. It is also affected by buildings such as granaries, aqueducts, and hospitals (buildings that allow a higher city size or growth rate). If you have Granaries in all your cities, the average is 46 years. When I have one city with population 3 with a granary, and 1 city with population 1 without a granary, I get 40 years, suggesting that the pre-aqueduct formula is something like:
Life Expectancy = (46 * population in city with granary + 20 * population in city without granary)/total population
Note that this doesn't appear to be floored like military service (or I would have had 39 years instead of 40 - in my example it came out to 39.5). I haven't looked into the details of aqueducts' specific effects yet, and also am unsure what affects wonders such as Longevity and Cure for Cancer have.
As for literature, I recall that it actually falls after Education is discovered before any universities are built. The Great Library also has a considerable effect on it. But I don't know the exact formulae.
Edit: The population is the sum of the POP figure in all your cities. IIRC, it's something like:
1: 10,000
2: 30,000
3: 60,000
4: 100,000
5: 150,000
6: 210,000
etc. - each pop adds 10,000 * pop number to the pop. So you could write it as something like:
pop(1) = 10,000
pop(x) = 10,000 * x + pop(x - 1)
I have it written down up to population 23 or so on a piece of paper from circa 2005.
Note that these figures are assuming there are no food stores in the city. If there are, it's in between the bounds above, but I haven't formulated it exactly (in part because the bounds differ for AIs on non-regent difficulties). The overall figure in F11 also seems to get slightly off when the population is around 300,000,000 or so.