Sexual orientation is based on genetics, and is not changed much after you are born by any factors.
Gay people are not able to reproduce. However, a trait which made a small amount of the population gay is nevertheless selected.
One theory is that gay people act as caretakers for the family or tribe, and do not stress resources further by making more children.
Prevalance of the gay trait
The specifics are not known due to cultural biases and distinctions. People in some cultures do not identify as gay while having routine same-sex sexual interactions.
In general, between 2% and 10% of people are gay.