There are many factors. It could be an evolved trait much like frogs can change gender depending on conditions. Perhaps there are gay genes that kick on in response to certain stimuli. Or just something went haywire inside the womb, outside the womb or most likely a combination of many factors. And there is the occasional homosexual that will chalk it up to choice.
Clearly the option to have *** is a choice, but having *** doesn't make one homosexual or heterosexual, having *** makes one sexually active. Ie, I've always been heterosexual, but I haven't always been sexually active.