The term "S&M" stands for Sadism and Masochism, and the historical definitions and depictions of S&M are often stereotyped and nonconsensual. The term "SM" stands for sadomasochism, which is a type of sexual orientation or behavior. Many people call it SM to emphasize the need for consent since both behaviors are united in a single word. SM is also sometimes referred as "leather," "Dominance & Submission," "D&S" and "BDSM".
As the language has evolved, the contemporary definitions of sadism and masochism are changing. Sadism no longer implies non-consensuality, nor does it imply violence. It simply means that someone receives erotic gratification from the infliction of psychological or physical stimulation on a consenting partner. Conversely, a masochist is someone who enjoys receiving that psychological or physical stimulation.
We do not know why some people are heterosexual and others are homosexual. We do not know why some people eroticize breasts and others legs. We do not understand how people develop any particular eroticism. We do know that no one has found any characteristic in childhood history, birth order, etc., that is more common among SM practitioners than the general public. Specifically, there is no indication that SM practitioners are more or less likely to have been spanked as children, or to have been the victim of sexual or other abuse as children.
SM is about sensation and stimulation, exchanging power, trusting one's partner, and sharing love and pleasure. Some SM practitioners seek "pain" but they want the sensation administered in a way that is ultimately pleasurable to them.
"Much S&M involves very little pain. Rather, many sadomasochists prefer acts such as verbal humiliation or abuse, cross-dressing, being tied up (bondage), mild spankings where no severe discomfort is involved, and the like. Often, it is the notion of being helpless and subject to the will of another that is sexually titillating... At the very core of sadomasochism is not pain but the idea of control - dominance and submission." (Thomas S. Weinberg and G.W. Kamel (1995). "S&M: An Introduction to the Study of Sadomasochism," S&M: Studies in Dominance and Submission, Prometheus Books, pg. 19.
"The essence of sadomasochism is not so much "pain" as the overwhelming of one's senses - emotionally more than physically. Active sexual masochism has little to do with pain and everything to do with the search for emotional pleasure. When we understand that it is pain only, and not cruelty, that is the essential in this group of manifestations, we begin to come nearer to their explanation. The masochist desires to experience pain, but he generally desires that it should be inflicted in love; the sadist desires to inflict pain, but he desires that it should be felt as love...." (Havelock Ellis, M.D. (1926). Studies of the Psychology of Sex, F.A. Davis Company, pg. 160.)