How do kids know in high school if they are gay or lesbian?

Ask them. Ask them. A corollary would be how did you know in high school that you are heterosexual? I bet the answer is the same.
Gay males know. Sexual attraction is powerful in anyone but with teen males its off the charts. At the same time straight boys start noticing girls their gay friends start noticing them. It comes from the center of a boy's soul. When family, friends, and church tell him its wrong it tears him apart and he over compensates. "he had a's, sports trophies, and gfs, the last person we'd expect to kill himself".
Struggles. It's common for people to know at really young ages, but in denial throughout their life until they are comfortable enough to "come out". The best way is to support when they do.