David P. Barash explores the evolutionary mystery that is homosexuality, raising the possibility that being gay serves no direct biological purpose:
Homosexual behavior might be neither adaptive nor maladaptive, but simply nonadaptive. That is, it might not have been selected for but persists instead as a byproduct of traits that presumably have been directly favored, such as yearning to form a pair bond, seeking emotional or physical gratification, etc. As to why such an inclination would exist at all—why human connections are perceived as pleasurable—the answer may well be that historically (and prehistorically), it has often been in the context of a continuing pair-bond that individuals were most likely to reproduce successfully.
There are lots of other hypotheses for the evolution of homosexuality, although they are not the "infinite cornucopia" that Leszek Kolakowski postulated could be argued for any given position. At this point, we know enough to know that we have a real mystery: Homosexuality does have biological roots, and the question is how the biological mechanism developed over evolutionary time.
Another question (also yet unanswered) is why should we bother to find out.
Because I'd like to know? My own reflections on this topic, "What Are Homosexuals For?", form the epilogue in Virtually Normal.
(Photo by Flickr user heatkernel)