This is a short title for an incredibly complicated topic. There are many different types, causes and pathways for pain. For the purpose of this discussion I will limit the discussion to acute and chronic pain that involves inflammation.

At the cellular level, the horse's body is in a constant dynamic balance between damage and repair, death and replacement. When this balance is disrupted in favor of death and damage, whether from injury or simply temporarily from overdoing exercise, it triggers the release of cytokines.
 
Cytokines are small proteins which allow cells to "talk" to each other and directs their activity. For a much more in-depth description, see this link. There are 45,161 entries to date in the cytokine encyclopedia associated with this web site.
 
In most cases, production of cytokines is turned off in default mode. Their production begins in response to cell injury or death. In addition to directing clean up and repair processes, cytokines are an integral part of triggering pain. Some, such as one with the deceptively innocuous name BAMBI, react directly with nerve endings or neurochemicals. Others respond to reactive oxygen species (ROS)/oxidative stress associated with cell injury, and keep the reaction going.
 
Cytokines aren't all bad. Once damage has been cleaned up by the immune system, cytokines are important players in the regrowth of blood vessels and cell regeneration.
 
Pain is the body's way of signaling that there is a problem. The nervous system will reflexively act to protect injured areas by splinting muscles and limiting movement. Since horses don't follow directions, this function of pain is important in reducing the chance of further damage.
 
Our first impulse on finding the horse is pain is to get rid of it, but this must be tempered by realizing pain has a protective role. Anti-inflammatory pain medications are also a bit of a sledgehammer approach because they also inhibit pathways needed for healing.
 
There are ways to work with the horse's own homeostatic mechanisms to assist these mechanisms in dealing with inflammatory reactions. For example, MSM (methylsulfonylmethane) helps maintain normal counter-regulation of the  cytokines TNF-alpha and IL-6 and supports antioxidant defenses.
 
Speaking of antioxidant support, you have many effective options there including bioflavanoids, vitamin C, low dose garlic, N-acetyl-cysteine, quercetin, lipoic acid and vitamin E as well as the herbals Turmeric, Boswellia, Ginger, Ginkgo and grape seed extract.
 
Harpagophytum procumbens (Devil's Claw) offers powerful nutritional support against oxygen free radicals as well as cytokine TNF-alpha and IL-6 plus harmful prostaglandins. Devil's Claw also has a direct nutrigenomic effect in maintaining normal activity of genes involved in TNF-alpha and COX-2 enzyme activity.
 
We dislike pain, and no one wants to see a horse suffer, but it serves an important purpose. The trick is to recognize the source of the pain response and assist the body in returning to normal balance without interfering with healing. Targeted supplementation has a lot to offer in that battle.