The only SURE way to know is to ask him, however the easier way to tell is to watch his eyes, this can be hard as he may think you're staring at him, but if you can watch when a guy walks by, if he looks in same manor that straight people look at girls, and he does this multiple times to guys then he is most likely gay. Also, generally if he likes someone when he looks at them and they look at him, his eyes will really quickly look down, then to the left then back to the person he was looking at, it's hard to notice but it does happen. Good luck
Alot of times you can simply see it in someones demeaner. How they hold themselfs, walk, dress, etc. This obviously doesn't apply to everyone. I agree with the rest of what Zaio said.
Well obviously the only way you can know for sure is if you ask him but here are a couple tips. Look for accessories on his left hand. Try to see if he has a rainbow bracelt or a pink, blue, and purple one if he's bi. This one is a little difficult but try to watch his eyes. If they seem to linger on guys a lot, it's usually a tell tale sign.