I'm generally heterosexual, but I've also had sex with a man. It's was okay, I guess, but I'd prefer women. On a scale of 0-100 my "gayness score" is probably about 10-20. A hard strong 0 or 100 is probably a lot less common than it's often portrayed: it's more of a bell curve.
One explanation I've read is that gay men are more likely to be left alone with women as they're perceived to be less threatening; giving the gay man a chance to propagate his genes through infidelity (infidelity is fairly common throughout human history). The ever-eqloquent Richard Dawkins once called this "the sneaky fucker strategy".
Something similar could also apply to women.
It's hard to be sure of these kind of things, since it's, well, pre-history, but there are some models which can explain the propagation of homosexual genes and/or behaviour.