How do a person know when they have HIV or STD my friend think he have it

See a doctor. This is a serious issue and not for amateurs. Consult a doctor asap.
HIV . Hiv is diagnosed by a blood test. If your friend thinks he has an std or hiv, tell him to see a doctor as soon as possible and to refrain from having sex with anyone else until he knows.