I find that most of the time it kind of comes up naturally. Like if they start talking about a celebrity they like, I bring up a female celebrity I'm really attracted to. "Oh, yeah, I guess Johnny Depp is ok, but Zoey Deschanel, like woaah!" Or something like that where it makes it obvious. Or I talk about my exes or I mention that I won't patronize a certain business because they aren't gay friendly. If a friend is being particularly obtuse or difficult or is very disrespectful or likely to have a problem with it, I make a point of sitting them down and talking about it. I let them know that I'm gay and that when they make anti-gay or non-gay-friendly comments it hurts my feelings. My most common response to someone saying something or someone is "gay" in a derogatory way is to proudly say "yes, yes I am." This usually shuts them up or sets the stuttering and falling over themselves to apologize. As the true but cliched adage goes, if they really have a problem with who you are and can't respect your feelings, they are not your friends.