
Maternal condition and environmental quality can alter the chances of whether a mother will conceive and give birth to son or daughter. Mothers in top physical condition, who are well-fed or high status (and thus have choice access to resources), tend to have more sons. Under poor environmental conditions (such as an area with lots of pollution) or poor maternal condition, mothers tend to have more daughters.
From an evolutionary standpoint it actually makes a lot of sense. Among most animals, males compete intensely with each for the right to mate with a female. The stronger, bigger, taller and generally more fit male wins while the losers sulk off, sometimes never getting to mate. Many males are left out of the mating game altogether, which means having a male is risky. In contrast, most females do eventually get to mate. Having a son is riskier than having a daughter, unless of course, you are likely to have a son that is well-fed and likely to be dominant and exert control over the area's resources. If not, then it's much safer to invest in daughters because even poorly nourished daughters in less than ideal condition can still mate.
This idea is known in evolutionary biology as the Trivers-Willard hypothesis.
What's really cool is there is actually a good amount of evidence for it. The effect has been demonstrated in birds, insects, fish, ungulates, mammals — and even people.
Dr. Elissa Cameron of the Mammal Research Institute in South Africa put the results of 1,000 different studies of the theory through a statistical procedure called a meta-analysis. It's a fancy way of combining the results of lots of studies, some of which found evidence in support of the theory and some that didn't, so that we can determine what the data shows overall. She found that mothers who were in better physical condition at the time of conception were more likely to have sons.
No one knows for sure what the exact mechanism is. XY embryos are more fragile, less likely to work out, but no one knows what the physiological mechanism is exactly. It could have to do with the level of body fat and diet affecting how much glucose is present at the time of conception, or it could be the level of testosterone. Some people think it may be corticosteroids (stress hormones) that play a role. Either way, researchers think the mother's body either chooses certain eggs to develop, rejects sperm carrying X or Y chromosomes, or prevents eggs fertilized by those sperm to implant on a condition-dependent basis.
If you ask me, I think it's beyond cool that mothers can actually influence the sex of their child.
For amusement only, you can take an online test that tells you whether you'll have a boy or girl. The questions take into account personality factors and don't ask the right questions, so you have to take the results with a grain of salt.
If I were designing a test, I'd ask a bunch of questions about diet, weight, physical activity, socioeconomic status, living environment, and a few behavior questions that get at to what extent you actually act dominant. I think it would be a really neat study if years down the road participants were asked if they went on to have a boy or girl. That way, you could see how well the test predicts what it purports to, i.e. whether it's valid.
Here's the for fun only test: Baby sex test
There are other theories under development, including one with a working hypothesis that beautiful people tend to have more daughters.
And here's a study for more reading:
Increased levels of air pollution and a decrease in the human and mouse male-to-female ratio in São Paulo, Brazil. Fertility and Sterility, 87(1), 230 - 232
Lichtenfels et al