Epistemic status: Exploratory. I did basically no actual research for this post so please don't take anything I say at face value.
I've had problems with pain for basically my whole life, and over the years a lot of people have told me a lot of different things about why the pain happens and what I can do to fix it. This is my attempt to put all of those things in one place and see if I can make something coherent out of them.
This post grew out of the observation that for every chronic pain intervention I've encountered, there are hundreds of people who swear by it as a miracle cure (though it doesn't work for everyone), so each thing is probably at least gesturing in the direction of something true. But most practitioners are very attached to their own view of how pain works and view at least some of the others as crackpots, so I haven't seen anyone try to tie all of the theories together.
I start with brief explanations of all the theories I've looked into for more than five minutes, divided imperfectly into physical explanations and psychological explanations and presented roughly in chronological order of when I encountered them. Then I try to inelegantly smash them all together. (Note that this is basically the same path that Todd Hargrove followed, only he spent many years on it instead of a couple hours, so maybe just read his book instead.)
Survey of theories
The medical establishment (in the United States)
In my experience, complaints of chronic joint pain lead doctors to test your blood for rheumatic diseases and maybe X-ray any particularly painful bones or joints. If they don’t find evidence of disease using these methods, they kind of throw up their hands and walk away. If there is something visibly wrong with a bone/joint, they either 1) recommend physical therapy, 2) recommend surgery, or 3) be like ‘welp, I hope it heals on its own, that'll be $1000.’ They may also prescribe strong painkillers, but that feels more like a cop-out than an actual intervention to me, since it's not striking at the root of the problem.
Plausibly there is something more useful that doctors sometimes do, but beyond ruling out insidious diseases I have really not gotten a lot of value out of going to the doctor for this problem. To be fair, the modern medical establishment is much better than any alternative at curing viral and bacterial infections, treating life-threatening injuries, and keeping at bay serious diseases such as cancer and autoimmune disorders; chronic pain just isn't currently in its wheelhouse.
As far as I can tell, physical therapy seems to be predicated on the notion that your pain is a result of you doing something wrong or your body being out of alignment. Thus, the way to fix pain is to find the thing you're doing wrong or the place where your body is stuck, and teach you exercises that will correct that. Given that my PT was surprised at my large range of motion and graceful-looking movement, my impression is that physical therapy is mostly targeted at (and useful for) people whose problems are more outwardly obvious than mine.
To me, the most interesting thing about physical therapy was that most of the exercises my PT recommended were not actually targeted at the areas of pain, but instead focused on improving my core strength.
A Guide to Better Movement has a similar thesis that the mechanics of movement are a key part of understanding pain, but focuses much more on the role of the nervous system. I haven't finished the book yet but it seems quite promising, and I'll try to update this when I have a better grasp on what it's about.
The general idea of massage is that pain comes from tension in your muscles, and if you release the tension by working the muscles directly, the pain will go away. In an average (non-medical) massage, the massage therapist is likely to apply friction, percussion, and/or heat to your muscles. While this can be very effective at getting your muscles to relax, it's unlikely to lead to lasting changes in how you feel.
(EDIT 03/2019 - I was told all this information about fascia by a massage therapist, but I am now much less confident that it is correct.)
Fascia is a thing that surrounds muscles. It can be either a liquid or a solid, and when it solidifies it inhibits the range of motion in the area. I think this is supposedly what’s happening when you keep a muscle shortened for too long and then it’s later painful to move it (e.g. hunching at your desk or ‘sleeping on your neck weird’). I've been told that myofascial massage involves working on solidified fascia to turn it back into liquid, which maybe makes sense. I don't know.
Trigger point massage
Trigger points are "discrete, focal, hyperirritable spots located in a taut band of skeletal muscle. They produce pain locally and in a referred pattern and often accompany chronic musculoskeletal disorders." Massage focused on trigger points can release the tension in them, which alleviates the referred pain from the trigger point. I think acupuncture operates on the same underlying principle, only instead of massaging the trigger point you stick a needle in it.
Here is a Youtube video explaining trigger points in more detail. Lots of people report near-magical success self-treating with trigger point massage, and it's often recommended for people who have RSI in their arms . Disclaimer: Don't bank on magical results or even any results at all. Also note that trigger points may not be real.
Progressive muscle relaxation (PMR)
This isn't really a subcategory of massage, but it does operate on the same theory of muscle tension being the problem. In PMR, you systematically relax each of your muscle groups in turn, just by sitting there and thinking about it. It feels pretty good, and it can have somewhat deeper benefits if you practice enough to be able to do it quickly and as needed. Instructions can be found here, or lots of other places on the internet. Note that the first step, where you tense your muscles, is probably not actually necessary and might make you feel worse.
A therapist I went to suggested that chronic joint pain is often a result of undiagnosed food sensitivities, such as intolerances to gluten, lactose, or sugar. She didn’t expand on this at all but here’s my guess at a mechanism: If you’re consuming something to which you have an intolerance or low-level allergy, your body is treating it as an invader and will launch an immune attack, which can inflame the joints and manifest as chronic pain.
This seems plausible to me as an explanation for some cases, and particularly for mine, since I have known intolerances to lactose and gluten. However, my guess is that in most cases this would only be a small piece of the puzzle, one of many underlying causes that interacts with a bunch of other things. But that's just a random guess, and nutrition is really poorly understood in general, so take this entire section with industrial quantities of salt.
Neuroscience (specifically the research of Dr. Irene Tracey, from this article)
According to the article, people who suffer from chronic pain have an overactive pain amplification mechanism in the brain stem:
“Tracey’s latest research has investigated a key neural mechanism of chronic pain. It is situated in the brain stem… which functions as the conduit for communication between the brain and the body. Experiments on animals had identified two mechanisms within the brain stem that, respectively, muffle and boost pain signals before they reach the rest of the brain… Unfortunately, in some people the mechanism that exacerbates pain is dominant. Scanning the brains of patients with diabetic nerve pain, Tracey and Segerdahl found enhanced communication from the brain stem, via the spine, to the parts of the brain known to contribute to the sensation of pain.”
This is a pretty enticing explanation for why of two people with basically identical injuries, one may recover entirely after the injury heals while the other may experience a lifetime of chronic pain from the injury. I'd be interested in further exploration into the neurology of pain; my impression is that it's currently not a very large field.
Dr. John Sarno & Dr. Howard Schubiner
Sarno and Schubiners' philosophy is that pain is your body trying to distract you from stress/trauma, in what they call tension myositis syndrome or TMS. TMS can cause not only chronic pain, but also ulcers, nausea, dizziness, fatigue, weakness, stomach problems, ear disturbances, and other mysterious ailments.
Sarno says that if you just ask your body, “what is this pain trying to distract me from?”, the pain will disappear because it no longer has a reason to exist. How does this work? I… don’t know. The book doesn’t really explain that. It seems possible that it's... some kind of really strong placebo effect? Or... I don't know? The Sarno method sure seems a lot like Dark Arts, but that doesn’t explain away the fact that it works, at least for some people. (If you don’t believe Sarno’s claim that he’s cured over ten thousand people, maybe you'll believe the 400+ five-star reviews on Amazon from people saying they were cured forever.)
Sarno also advises that - since chronic pain is psychological - sufferers won't get better if they continue to pursue physical solutions for their pain, such as massage or physical therapy. This is a pretty dangerous claim to take at face value and could very well make things a lot worse, so if you read either The Mindbody Prescription or Unlearn Your Pain, be careful.
Note that Scott Alexander points out that Sarno’s claim that Lithuanians rarely develop chronic whiplash following a neck injury is probably not true. This is a fairly major strike against Sarno and Schubiner’s case that the reign of pain lies mainly in the brain.
Similar to Sarno, somatic therapy operates on the model that pain is your body expressing stress/trauma, but unlike the Sarno method, it's primarily marketed as a form of psychotherapy. For 'holistic healing', somatic therapy addresses the underlying trauma while also working with the body. The internet tells me that "therapy sessions typically involves the patient tracking his or her experience of sensations throughout the body. Depending on the form of somatic psychology used, sessions may include awareness of bodily sensations, dance, breathing techniques, voice work, physical exercise, movement and healing touch." It sounds sort of similar to Focusing?
Robin Hanson's signaling theory would probably say that chronic pain is you subconsciously signaling helplessness, which helps you get resources without having to do much work. Out of all the things I've discussed this one is definitely on the shakiest ground, since it just comes from moridinamael's speculations.
However, it feels pretty intuitively plausible to me, given that I often intentionally signal helplessness in other ways, and given that chronic pain is a great excuse for not being able to do stuff. When I was leading a dance group in high school and there was a lot of pressure on me to be perfect, my knee pain gave me an excuse for sometimes messing up. Now my carpal tunnel gives me an excuse for not always meeting my work goals, and more generally, pain gives me an excuse to sometimes lie in bed all day and whine and cry, which is not something it is normally acceptable to do as an adult.
My attempt at a synthesis
A first attempt
Your body is a very delicate machine, and if you do anything incorrectly - e.g. typing with bad posture, putting your weight on the wrong part of your foot when you walk, eating foods you're sensitive to, having breasts that weigh too much, or compensating for a weak core - it can mess the whole thing up in ways that aren't obviously connected to the thing you're doing wrong.
Your physiological responses to psychological stressors (such as trauma, anxiety, or feelings of helplessness) may then exacerbate the slight imperfections caused by whatever you're doing wrong, creating trigger points and other persistent pain.
Whether or not these problems (which have both physical and psychological causes) rise to the level of conscious attention depends on the activity of the pain amplification mechanism in your brain stem. There can then be a feedback loop, in which your brain learns that certain things are painful, and then is ever more careful about not injuring them, until any movement of the affected area (or even lying still) is agony. At this point, you have developed a chronic pain problem.
I feel that my model is missing the two-way interaction between the physical and psychological stressors. For example, if I feel vulnerable or defensive, I am likely to hunch my shoulders and generally tense up, which messes up my body. This two-way thing would help to explain why both psychological-only and physical-only interventions can fully cure some people's pain, since the cycle can be broken no matter where you intervene.
I think lasting cures probably all involve learning how to respond to stressors in a way that won't trigger a pain spiral. Under this model, too much reliance on external help that you don't understand (e.g. a massage therapist who 'works magic') will prevent you from solving the problem, even if it helps in the short to medium term.
The nervous system
I just have this feeling that Todd Hargrove knows what he's talking about. I will try to remember to update this when I've finished reading A Guide to Better Movement.
I'm confused about the role of surgery for chronic pain. Sarno claims that any benefits from back surgery are basically placebo, and says some pretty convincing things on that point. I also have a vague sense that surgery is over-prescribed in the US just because doctors don't have that many good solutions, and also because it makes the medical establishment money. I know at least one person who reports benefits from surgery for his RSI, but in most cases of RSI I don't think there's anything obvious to operate on, and RSI is quite clearly more about use than about underlying problems.
There is probably more than just the one neurological mechanism at work in chronic pain. In particular, differences in how brains process sensory input seem pretty important to me. My boyfriend has terrible typing posture and is obviously very tense (it's very painful for him when I press lightly on his shoulders), but he basically doesn't complain of pain at all. This is consistent with his tendency to get so focused on whatever he's doing that he doesn't notice hunger, fatigue, or people talking directly to him. I, on the other hand, notice every slight discomfort when I'm sitting at my desk, from the increasing tension in my neck to the gait of the person walking behind me to the tiniest amount of hunger, thirst, or emotional turmoil. In a nutshell, his processing is top-down, while mine is bottom-up.
There are a dozen other mysteries here.
I don't think my model is very good, but I've already put more time into this than I wanted to so I'm not going to change it right now. If you, reading this post, had a different idea for how the pieces might fit together, tell me about it in the comments. If there are some theories I listed that you think should just be thrown out entirely, tell me why.
Thanks for reading all the way to the end!! :)
 If you're interested in self-treatment with the trigger point method, the canonical text is The Trigger Point Therapy Workbook. Since you'll also need to buy at least one tool to help you execute the techniques, expect to spend ~$50. If you're more interested in the theory, try this ebook.