Gay people do have sex with the opposite sex. In most cases, it is not the sex they would prefer, but they are in fact capable of not only having sex with straight people, but having children with them as well. It’s a matter of conditions or circumstances, not function. Of course, nowadays, as you mentioned, other options are available to them. So unless they were born sterile, evolution does not disfavor gays in terms of reproduction. Being gay doesn't mean lack of sperm (for men) or lack of wombs (for women).

Also, it should be noted that sometimes individuals who cannot be identified strictly as gay will engage in homosexual activity. We see this a lot in populations where the female to male ratio is very low, or the presence of females is non-existence. Not just in prison, but other places as well. I remember reading one study that was done on males in the military prior to women having such a large presence in the armed forces. So, it appears that sometimes homosexuality is a choice and not genetics, however, only amongst true heterosexuals.

Some recent evidence suggests that homosexuality is not a genetic condition that is inherited, but rather is a condition that develops as a result of how many children your mother has. Homosexuality occurs more often in families that have a higher number of births from generation to generation. This suggests that it is in some way an attempt by nature to enact a form of population control, but that isn't in any way proven, it’s just speculation at this point. It could just be that homosexuals are occurring often because of the higher probability associated with higher birth rates. Can’t remember the increase percentages, but for every boy a family has, the chances of him being homosexual increases.

I think the sex drive is genetic but how it is satisfied is largely learned. There’s plenty of evidence that society teaches us what is beautiful and therefore: desirable sexually. It is just learned at such a young age people don’t remember their attraction to same sex. I have heard of those studies indicating a genetic inherited link and it does not make sense to me either.