Must preface that I'm a non-expert, this isn't my area of expertise, I'm just a curious person that seeks truth, and works as a programmer. I could be wrong, but when I find convincing evidence or logic that I am, you'll see me singing a different tune. If there are any credentialed evolutionary biologists among us, please, correct or affirm the following.

As with a lot of human traits that sprung from evolution, today it's not as clear as it would've been. In tribal structure, we needed more caregivers to children. Having a few homosexuals uninterested in breeding assisted with survival of the group. Everyone around the world needs additional caregivers, members of the tribe died early often. Someone had to raise the next generation, and the risks of dying were plentiful. Beyond famines and death from conflicts, shamanistic medicine only, no scientific medical care and definitely no vaccinations or antibiotics. Basically, people dropping like flies. The unpredictable death rate required a proportionally larger quantity of caregivers than breeders.

Further, any trait that exists in ~5%+ of the population over time is regarded as having an evolutionary purpose. Which homosexuality meets the definition of. For example, I'm color-blind, while no longer very useful (other than map spotting, which the US military does use color-blind folks for), it was an advantage for hunting in a snowcovered environment by removing unnecessary data for the brain to process, resulting in spotting prey faster and increasing reaction times. It's difficult to provide hard evidence for evolutionary traits, folks that want to dismiss it due to discomfort always will, but this trait was shown to appear in Ice Age Spain and spread from there. Caregiving for the tribe goes much further back in time, hence homosexuality being far wider reaching. Neither gay folks or color-blind folks are deserving of disdain though, simply because we're the products of hundreds of thousands of year of human survival and those traits are not as relevant today. All humans have traits that aren't perfectly suited for sitting behind a computer all day, or the modern age. It's a shame we haven't evolved to consume glyphosate, or breathing the air we're polluting without dying of cancer.

An addendum that I feel is necessary. You could seek out a scientist who has dedicated their entire life to studying this topic to confirm/deny my claims, or a professor at a local university who has essentially done the same and dedicated their professional lives to this topic to learn more. That's what I would do if genuinely curious and wanted to know more, not hit up DuckDuckGo. The ability of those folks to cut through the noise in their field is something a search engine doesn't offer. No different from an experienced programmer searching on software. There's an alarming trend of people today dismissing expertise and credibility as traits without merit. Experts on topics like this are still the go-to source. I'm just a layman in comparison. While I did not and will not spend more time digging up citations for my claims here, it is logical and based on prior readings. Neither is it my prerogative to convince every homophobe among us that being homosexual is more than OK, I do hope everyone who reads this chooses to embrace our gay brothers and sisters. It's illogical not to.