I don't assume that there is only one single factor, but here's something to consider. That long list psychiatric diagnoses which occur at much higher rates in homosexuals compared to heterosexuals are risk factors for suicide and all seem to be serotonin related. I don't think there are any on the list that aren't often treated with serotonin agonists. Serotonin is related to sexual orientation in mammals though exactly how it works in humans isn't clear. Now here is the interesting part, the brains of homosexual people react differently to the medications that are often used to treat these issues.
For example:
Fluoxetine is the SSRI more commonly known as Prozac.In accord with our hypothesis, differential effects were observed in the hypothalamus, with the homosexual group exhibiting a significantly (p ≤ .01) smaller reduction in hypothalamic glucose metabolism in response to fluoxetine as compared with the heterosexual group. Interestingly, areas not known to play a role in sexual behavior were activated differentially as well.
EDIT: A bit more...
The genetics of affective disorder and suicideLow central nervous system serotonin (5-HT) turnover has been shown to be related to suicidal behaviour [13]. Consequently, serotonin-related genes have been the focus of much attention in candidate gene association studies [4]. Meta-analyses have confirmed the association of suicidal behaviour with variants in the serotonin transporter gene (5-HTT, or SLC6A4) [12]...
McGuffin et al. [20]... estimated that the heritability of completed suicide was 43% (95% confidence interval 27–60%) and that there was no effect of shared family environment.
Is Homosexuality Based on a Brain Chemical?Rao and his team genetically engineered male mice to lack either serotonin-producing neurons or a protein that is crucial for making serotonin in the brain. Both types of altered mouse couldn't make serotonin.
Unlike typical males, mice deficient in the neurotransmitter showed no inclination to mount sexually receptive females more than males, nor did they prefer to smell females' genital odors or bedding. Instead, they climbed onto males and serenaded them with ultrasonic love songs more frequently than normal. Males emit these vocalizations when they encounter females to make them more receptive to mating.
While all of the males who possessed serotonin mounted females first, nearly half of the mice that lacked serotonin clambered onto males before females, and about 60 percent spent more time sniffing or hovering over the genital odors and bedding from males than from females.
In case anyone is wondering, no you can't change someone's sexual orientation by modulating serotonin levels. The mechanism probably has something to do with serotonin levels at a particular stage of brain development.