A follow up to the post below since I'm not sure I can post links in comments to posts.
Great question. The answer to this question (what percentage of people acquire HIV from sexual intercourse, through the sharing of needles, and by other means) will vary a lot depending on the time period you are asking about and the country you are asking about.
Let's look at a few examples.
According to the CDC, in 2005 the cumulative figures for the AIDS epidemic in the US were:
Male to male sexual contact - 48%
Intravenous drug use - 26%
Both Intravenous drug use and male to male sexual contact - 7%
Heterosexual sex - 17%
Other - 2%
The sample size here is almost a million people.
BUT in the year 2005 alone, the figures were:
Male to male sexual contact - 43%
Intravenous drug use - 20%
Both Intravenous drug use and male to male sexual contact - 5%
Heterosexual sex - 30%
Other - 1%
Spot the difference? Heterosexual transmission has almost doubled and now accounts for 30% of cases. The other figures have gone down accordingly.
The final example is Africa, where data is harder to come by but numerous sources suggest 80% of the HIV infections in Africa are due to heterosexual sex with mother to child (vertical) transmission accounting for most of the rest. This paper has further data on African and some other areas plus a few useful references.