Research shows that some creatures in the animal kingdom manipulate the sex of their child in order to maximize the number of grandchildren. Parents in good condition, based on health, size, dominance or other traits, would invest more in producing sons, whose inherited strength and bulk could help them better compete in the mating market and give them greater opportunities to produce more offspring. Conversely, mothers in poor condition would likely play it safe, producing more daughters, whose productivity is physiologically limited.
This setting takes place in the ancient world, before advances in medicine and technology. I want to biologically alter humans in a way that allows individuals to manipulate the sex of their children. How could this work? Would it make sense to put this ability in males or females?