Question: Why is it beneficial to feel pain?

Hypoalgesia


Hypoalgesia or hypalgesia denotes a decreased sensitivity to painful stimuli.
Hypoalgesia occurs when nociceptive (painful) stimuli are interrupted or decreased somewhere along the path between the input (nociceptors), and the places where they are processed and recognized as pain in the conscious mind. Hypoalgesic effects can be mild, such as massaging a stubbed toe to make it hurt less or taking aspirin to decrease a headache, or they can be severe, like being under strong anesthesia. Hypoalgesia can be caused by exogenous chemicals such as opioids, as well as by chemicals produced by the body in phenomena such as fear- and exercise- induced hypoalgesia.  Hypoalgesia can also be associated with diseases, such as CIPA or in less severe cases with diabetes or other diseases associated with hypertension.
Chemical causes
Analgesics

Analgesics are a class of biochemicals that cause hypoalgesia. Analgesics can act on both the peripheral and central nervous systems to decrease pain. Certain analgesics also work to decrease the source of the pain by working to decrease swelling and inflammation, as in the case of NSAIDs.[1]
Opioids

Opioids refers to a specific group of analgesics - including morphine, codeine, and opium - that act on opioid receptors, which are located mainly in the central nervous system.
Endogenous opioids are types of opioids produced by the body specifically to modulate pain. They include endorphins, enkephalins, dynorphins and endomorphins. These peptides are especially important for modulating pain in response to the environment. These can be released in response to a number of things, including increased blood pressure, pain and danger. It has been found that endogenous opioids are at least partially responsible for phenomena like “Runner's high”, hypoalgesia in the fight-or-flight response, and even for the analgesic effects of acupuncture therapy.[2] In all these cases, there is a certain level of signal processing that occurs in the CNS which leads to the release of these chemicals.
Exercise-induced hypoalgesia
There has been a great deal of research examining the link between exercise and hypoalgesia. Many studies have shown the direct link between the two by subjecting patients to exercise and rating their pain responses, but despite the great deal of research, the mechanism of action is still poorly understood. It has been shown that the triggering mechanism for the hypoalgesic effects is caused by the increase in blood pressure that accompanies a good workout. The body senses the increased blood pressure, and it is hypothesized that in response, endogenous opioids are released.[3] This hypothesis is well supported in human research, and it has been verified that it plays a part, but animal research implies that other mechanisms are also involved [4] such as the endocannabinoid system.[5]
Fear-induced hypoalgesia
Fear induced hypoalgesia is another example of a mechanism controlled by opioids. It is postulated that fear is a defense mechanism that has evolved over time to provide protection. In the case of hypoalgesia, a decreased response to pain would be very beneficial in a situation where an organism’s life was at stake, since feeling pain would be a hindrance rather than a help. It has been well documented that fear does cause a decrease in pain response,[6] however much like the exercise induced hypoalgesia, the exact mechanisms of action are not well understood. Studies have shown that opioids are definitely involved in the process, yet opiates alone do not completely explain the analgesic response.[7][8] What the other mechanisms of action are is still unknown.
Diseases
It has been demonstrated that many diseases can cause hypoalgesia. Some diseases, like CIPA, are hereditary disorders where genes essential for the correct functioning of nociceptors no longer work. There are many diseases like this, and they all fall under the category of hereditary sensory autonomic neuropathies. Alternatively, some diseases affect other functions in your body, which can activate the pathways that cause hypoalgesia. This effect happens in people with diabetes and other diseases associated with hypertension.
Hereditary neuropathies
Hereditary sensory and autonomic neuropathies (HSAN), e.g. CIPA, are hereditary disorders that are characterized by malfunctioning or nonfunctioning pain receptors.[9] Most of these diseases are also associated with decreased temperature sensation as well. In some cases these diseases are also associated with other symptoms like mental retardation and diminished production of sweat and tears. Diseases like this can be very dangerous for the patients, because they are not able to judge what hurts, and therefore when they should stop doing something. A child with the disease might bite their finger clean off before they realized that what they were doing might harm them, or they might leave their hand on a hot stove without ever realizing it was on. These examples support the theory that pain is essential for life, more specifically, survival.
Hypoalgesia and hypertension
Some studies have shown that hypertension in patients can cause hypoalgesia.[10][11] Diseases like diabetes, which are associated with hypertension are also associated with hypoalgesia, however this is due to diabetic neuropathy. Just like in Exercise-Induced Hypoalgesia, the increased blood pressure of hypertension works as a signal to the body to release opioids and activate other pain modulation pathways.  Also, although the area is not widely studied, there is evidence that this is not the only cause. Diseases may lead to activation of any of these mechanisms, just like diabetes causing hypertension. A full study of the pathways regulating pain is needed.
See also
Hyperalgesia
Hypoalgesic effect of swearing