Masochism

Masochism is a medical condition. People who suffer from it can get pleasure from being hurt or humiliated by others. Often, the pleasure is sexual. When a person gets pleasure from being the one who causes hurt or humiliation, their condition is called Sadism.
The word "masochism" was invented by Richard von Krafft-Ebing, a German psychiatrist. He named it after Leopold von Sacher-Masoch (1836-1895), a writer whose books and stories often featured men in love with women who treated them cruelly.
Different forms of Masochism.
Many people with masochistic feelings do not really want to be hurt badly. They want to act out their daydreams, such as being tied up and kidnapped, or becoming the slave of another person. In BDSM, people often agree who will be "dominant/dom" and "submissive/sub" before they do anything together, and talk about exactly what they will do before they do it. People who do this kind of masochism usually do it for sexual excitement.
Most people who practice BDSM are concerned about their partner's safety. When people are careless about safety, or have no partner and play masochistic games when they are alone, it can be very dangerous. In some cases people have died from such games, especially when they involve suffocation, like hanging or rubber masks, even more dangerous when making it hard to get out by putting themselves in things like handcuffs.
Some people suffer from emotional masochism. They are more comfortable when they feel sad or consider themselves failures in life, or prefer to be in a relationship with someone who cheats or insults them. People who have these kind of feelings may have been bullied or abused earlier in life, or may feel that they do not deserve success and happiness.
Sometimes, self-injury is seen as a form of masochism which is not motivated sexually. Other behaviours, such as nail biting or trichotillomania often occur in situations where there is a lot of stress or pressure on the individual. While they are related to the individual's way to deal with stressful situations, they are also often rooted in the personality.
Treating masochism.
Treating masochism is difficult, but it looks like psychotherapy can help in some cases. People who like to be hurt during sex often say they're happy, though. Even not in sex, masochism can be natural in people.