The way pain is created is that the body senses danger through nociceptors, which are essentially danger nerves. The body sends these danger signals up to the brain, and then the brain has to make a a decision about whether creating pain will help you to be safer.
The brain weighs the world outside and in, and if it feels that there is more danger than safety then it will produce pain. Likewise if your brain thinks that there is more safety than danger then there will be no pain.
Interestingly if the damage to the body is so severe that nothing you can do will improve it, (like having a leg blown off) then the brain won’t produce any pain. Which is fascinating! This shows that the pain system is a self defence mechanism which is designed to get us to act.
Perhaps that isn’t so applicable to us as climbers, but what is interesting is that our perceptions about what is going on in our body will have a huge impact on our pain experience. For example we can create a narrative in our minds about what we’ve done to our bodies without ever having our injuries diagnosed. This leads to fear, which leads to more pain, which in turn slows down the time it takes to feel back to full health.
There are loads of really fascinating studies which go over some of the strange intricacies of pain and how it can be reduced by simple things. One of the ways is to simply understand how the pain process works. Another is the language used around your injury. For example when you twist an ankle you never hear people say that they had a partial rupture of their ankle tendons, but this has become the norm in the climbing community and is quite a scary set of words which only serves to increase fear levels in athletes and thus increase pain levels.