The book "Sperm Wars" (great read, btw) had a novel theory about homosexuality -- instead of treating it as an outright barrier to reproduction, it stated that there was a continuum, and that men with gay tendencies (not sure how gay women fit in here) might be more likely to have sex with everyone, i.e. "everything that moves."
According to this theory, men who aren't at the far end of the continuum (e.g. so gay that they abhor even thinking about sex with a woman) might be more likely to be very sexually driven, to the point that they are having sex with women all over the place, as well as men -- basically, the same thing that causes their "gay" behavior is really just promiscuity turned up so high that it overrides sexual barriers (and spreads genes when it gets women pregnant). I do see some truth in this, as I know plenty of gay men who have had sex with straight women (and these guys were very gay), and speaking personally, I can see how urges could override traditional sexual mores to include sex with married women, men, transsexuals, etc. The book even speculated that this promiscuity and tendency of these super-revved up men to get other guy's wives pregnant might be part of the root of homophobia.
Personally, I subscribe to a mostly genetic theory of homosexuality. While I do admit that there are certain cases where a boy or girl has been so sexually and emotionally traumatized by someone that they never again feel safe around that gender, and thus veer over to the other one through aversion therapy and personal choice due to psychological damage, I do not think these are the majority. I think maybe these kind of people are less than 10% of the whole.
I think the gay gene is probably a population control, as mentioned earlier. This would explain why it is common in the animal kingdom. The gene is probably recessive, which means that the straight brothers and sisters of gay siblings could still pass it on to their children, but not be gay themselves, getting around the whole "if they don't reproduce, gays don't exist anymore" argument. There have also been some statistically significant studies that show the more sons a woman has, the higher chance the younger ones will be born gay (probably due to hormonal accumulation in the mother's body and exposure in the womb). They've also done studies with rats that show that exposing the pregnant mother to stress while pregnant multiplies the chance the baby rat will end up gay. These things seem to point to biological mechanisms that attempt to cap a population to maintain the gender balance (or those fighting for access to females and males), or that preserve overall resources in the face of stress.
Mentally, my feeling is that gay men and gay women have the wiring of the opposite sex. I've lived and worked around far too many gay men and women to ignore the fact that gay men tend to act and think in many ways just like women (and sometimes like to try on their mother's and sister's closthes), and gay women, just like men, including being rude or insensitive like men. I think that perhaps if sex changes were a more viable option at a young age here in this country, you might find out a lot of gays are actually transgender, Cher's gay daughter, case in point. This is probably why countries like Thailand, where transgender folks have some rights (but not full rights), and let you have the hormones and surgery early in life, have so many transgender people in society.
Instead, I think a lot of gay men and women hit puberty not really knowing that becoming transgender is an option (and seeing the harsh life that awaits a transgender person in the U.S. and Europe), see the sexual changes from puberty that pretty much cement their body form in either a masculine or feminine shape, and decide to make the best of what they have. And this is why you see extremely masculine men who are in good shape but sound like Tinkerbell when they talk, and women with wide hips and large breasts who tape them down and try to act like guys. In another society, they would have gone the route that would have made them something else, but they got the option too late in life, and only the most dedicated go the transgender route after the full onset of puberty.