Safety help us solve a long-standing puzzle of fictional pleasure, one that was beautifully summarized by David Hume in 1757:
It seems an unaccountable pleasure which the spectators of a well-written tragedy receive from sorrow, terror, anxiety, and other passions that are in themselves disagreeable and uneasy. The more they are touched and affected, the more they are delighted with the spectacle. . . . They are pleased in proportion as they are afflicted, and never are so happy as when they employ tears, sobs, cries, to give vent to their sorrow, and relieve their heart, swollen with the tenderest sympathy and compassion.
Hume is marveling at the fact that viewers of a tragedy get pleasure from emotions that are normally not good ones to have, such as sorrow, terror, and anxiety—the more of these emotions they get, the happier they are.
Fictional narrative appeals to us because ultimately we are safe from the dangers that afflict the characters. But indeed it is pleasurable and exciting because though we are safe, we are not in total control of what we experience in the narrative. And the lack of control and suspense is exactly what makes it pleasurable.
However it is important that we do have control over the intensity of the pain. The lover of spicy foods needs to have power over what's going into her mouth; the horror-movie fan gets to choose the movie and is free to close his eyes or turn his head. And in sadomasochism (S/M) it's critical for the person experiencing the M to have some sort of signal that means Stop and for the person doing the S to immediately respond. The signal is sometimes called, appropriately enough, a "safe" word.
Thus masochism isn't really about pain and humiliation, it's about suspense and fantasy. Control is essential and this is what makes masochistic pleasure so different from ordinary pleasure. In a disturbing discussion, the writer Daniel Bergnci describes how a horse buyer named Elvis chose to be basted with honey and ginger, tied to a metal pole, and roasted on a spit for three and a half hours. This is a lot of pain. My bet, though, that if Elvis woke up one morning, stepped out of bed, and badly stubbed his toe, he wouldn't enjoy it at all, because it is not what he signed up for.
The ultimate test case here is going to the dentist. One article on sadomasochism describes a woman with a high need for pain in S/M sessions with her boyfriend, but who hated going to the dentist. The boyfriend tried to get her to construe a dental exam as an erotic masochistic adventure, but failed. There was no getting around the fact that the dentist was necessary pain, in something she chose.