Most orgasms happen during masturbation or sex (like oral, anal, or vaginal sex) when you or a partner stimulates (touches or rubs) your genitals. People with vulvas usually have orgasms through stimulation of their clitoris, vagina, and/or anus. People with penises usually have orgasms through stimulation of their penis, testicles, and/or anus. A few people can have orgasms from other things, like nipple stimulation or even just thinking sexy thoughts.
Many things can impact your ability to have an orgasm, like your hormones, emotions, past experiences, beliefs, lifestyle, relationships, physical or mental health, taking certain medicines, and using alcohol or drugs.