Answer:
You don't always know, sometimes they hide it or they don't act stereotypicaly gay. Some gay guys act feminine, for example talking in a high pitched voice or wearing feminine clothing. Some guys can also seem gay, but they aren't. It can be confusing at times. The best way to know for sure is wait until they tell you.
Or, you could become close friends with them, if your a boy, and wait till they ask if you want to make out.