Okay, now we have talked about how human traits are generally complex, and result from the interaction of multiple alleles, multiple genes, the environment, and random chance.
Let's apply these concepts to sexual orientation. It is estimated that some degree of homosexuality exists at about a 5-10% rate in the overall human population; it is found in all races and all societies, although depending on the social response, gay people may closet themselves for fear of exclusion, imprisonment, or death. Not all these people may identify strongly as gay or lesbian; sexuality is fluid and on a continuum. So probably about 2-5% of the population are more strongly homosexual. This persistence suggests that being gay is a fairly constant human variant, which can't be limited to a single environment or precipitating feature.
There is very good evidence for a genetic component of sexual orientation; in twin studies, the correlation of sexuality is way higher than its rate in the population (I've read as high as 50%), although it is not 100%. A lot of gay rights opponents say, "a-ha! if it were truly genetically determined, it would be 100%!" But this ignores the complexity that we discussed before; a geneticist would never expect something this complex to be 100% determinate; there is too much variation in the system. Even identical twins in a common environment are not identical for all traits which can be affected by random chance, imprinting, and epigenetics.
Does this high correlation mean being gay is always inherited? Is there a single "gay gene"? No, not likely, and not necessarily for all gay people. Remember, in the interplay of genes, environment, and chance, the relative weight of any variable may differ from person to person. "Chance" may be a random mutation that was not present in the parents, (we are loaded with them), or a stochastic developmental pathway, as with handedness. Different combinations of different genes may contribute to a common outcome. It is likely that something as complex as sexual behavior has numerous inputs.
Consider the fruitfly, a workhorse of developmental genetics studies. Fruitflies are simple animals, behaviorally speaking. They don't live in large and complex social groups with diverse and complex behaviors. But even in the fruitfly, where sex is pretty hard wired, there are a number of genes that affect sexual behavior in diverse ways--some of which affect the wiring of the brain, others of which affect overall development of physical structures.
No one seems to have trouble recognizing that other characteristics are complex: think intelligence, or athletic prowess. We know that there are likely numerous genes that contribute to these, and that it's not simply genetic, although genetics makes a contribution. Why do some people have such a hard time with sexuality being just as complex?
So is there a component of environment? Possibly: there's a chemical environment in the womb, for example, and a psychological component in the family we grow up in. Gay men are more likely to have older brothers, for example. However, these are also variables, not absolutes, which occur on the background of the genetic variation we described. But it's not a simple cause-effect: you can't turn an infant gay by bathing them in hormones.
The genetic data are clear that there is a genetics component. It's not the whole story, necessarily, but it's certainly a big part of it.
To read this entire series in order, visit the Genetics Page.