Nature.
There's a trait that when someone gets pregnant with many sons in succession, the younger ones are more likely to be homosexual. This is evolutionarily advantageous (keeping in mind that we evolved in small hunter-gatherer tribes) since it increases the resource-production capacity of the tribe without adding to its population in the next generation, which keeps the tribe small enough to be able to gather the resources it needs, making sure that there are not too many people who are either too young or too old to take part in hunting or foraging.
This doesn't explain all facets of sexual orientation (for instance, I don't know if something similar happens with multiple daughters) but it is selected for by evolution, since those tribes are more likely to survive.