The topic is a complex one. It falls under the topic of "Neuro-Psychiatry," or the field that attempts to understand qualities that are observed in people's behavior (like addiction, intelligence, sexual orientation, risk taking, etc.) with underlying neurological mechanisms.
With any behavior, there is an aspect that is modifiable, and there is an aspect that is not. (Much like one's risk of developing heart disease.)
The evidence at this point seems to suggest the sexual orientation is at least partially explained by some
in utero event. To date, the best predictor of homosexuality in men is the number of older brothers you have. It matters not if these brothers grew up with you or if you've even ever met them, it only matters that you shared the same womb.
There are several large scale studies underway (most famously, the
gay brothers study) looking for a genetic basis for sexual orientation. This genetic link is suggested by twin studies, but twin studies can't reveal a gene, they only suggest a genetic propensity.
Here's some studies for starters, if you are really interested:
Blanchard, R., Cantor, J. M., Bogaert, A. F., Breedlove, S. M., & Ellis, L. (2006). "Interaction of fraternal birth order and handedness in the development of male homosexuality." Hormones and Behavior, 49, 405414.
Rahman Q. (2005). The neurodevelopment of human sexual orientation. Neuroscience and Biobehavioral Reviews 29 :10571066.
Williams et al. (2000). Finger-lengths ratios and sexual orientation. Nature 404:455-456.
Bailey, J.M., Dunne, M.P., Martin, N.G. (2000). Genetic and environmental influences on sexual orientation and its correlates in an Australian twin sample. Journal of Personality and Social Psychology, 78(3)
Santtila P, Sandnabba NK, Harlaar N, Varjonen M, Alanko K, von der Pahlen B. Potential for homosexual response is prevalent and genetic. PMID: 17904267
Muscarella F, Elias VA, Szuchman LT. Brain differentiation and preferred partner characteristics in heterosexual and homosexual men and women. Neuro Endocrinol Lett. 2004 Aug;25(4):297-301. PMID: 15361821
Bodo C, Rissman EF. The androgen receptor is selectively involved in organization of sexually dimorphic social behaviors in mice. Endocrinology. 2008 May 8. PMID: 18467440
bth