Some time ago, I came across the All Souls College philosophy fellowship exam. It's interesting reading throughout, but one question in particular brought me up short when I read it.
What, if anything, is bad about pain?
The fact that I couldn't answer this immediately was fairly disturbing. Approaching it from the opposite angle was much simpler. It is in fact trivially easy to say what is good about pain. To do so, all you need to do is look at the people who are born without the ability to feel it: CIPA patients. You wouldn't want your kid saddled with this condition, unless for some reason you'd find it welcome for the child to die (painlessly) before the age of three, and if that fate were escaped, to spend a lifetime massively inconvenienced, disabled, and endangered by undetected and untreated injuries and illnesses great and small.
But... what, if anything, is bad about pain?
I don't enjoy it, to be sure, but I also don't enjoy soda or warm weather or chess or the sound of vacuum cleaners, and it seems that it would be a different thing entirely to claim that these things are bad. Most people don't enjoy pain, but most people also don't enjoy lutefisk or rock climbing or musical theater or having sex with a member of the same sex, and it seems like a different claim to hold that lutefisk and rock climbing and musical theater and gay sex are bad. And it's just not the case that all people don't enjoy pain, so that's an immediate dead end.
So... what, if anything, is bad about pain?
Let's go back to the CIPA patients. I suggested that they indicate what's good about pain by showing us what happens to people without any: failure to detect and respond to injury and illness leads to exacerbation of their effects, up to and including untimely death. What's bad about those things? If we're doubting the badness of pain, we may as well doubt the badness of other stuff we don't like and try to avoid, like death. With death, there are some readier answers: you could call it a tragic loss of a just-plain-inherently-valuable individual, but if you don't like that answer (and many people don't seem to), you can point to the grief of the loved ones (conveniently ignoring that not everybody has loved ones) which is... um... pain. Whoops. Well, you could try making it about the end of the productive contribution to society, on the assumption that the dead person did something useful (and conveniently ignore why we tend not to be huge fans of death even when it happens to unproductive persons). Maybe we've just lost an anesthesiologist, who, um.... relieves pain.
And... what, if anything, is bad about pain?
Your standard-issue utilitarianism is, among other things, "hedonic". That means it includes among its tenets hedonism, which is the idea that pleasure is good and pain is bad, end of story. Lots of pleasure is better than a little and lots of pain is worse than a little and you can give these things units and do arithmetic to them to figure out how good or bad something is and then wag your finger or supply accolades to whoever is responsible for that thing. Since hedonists are just as entitled as anyone to their primitive notions, that's fine, but it's not much help to our question. "It is a primitive notion of my theory" is the adult equivalent of "it just is, that's all, your question is stupid!" (I don't claim that this is never an appropriate answer. Some questions are pretty stupid. But I don't think that one of them is...)
...what, if anything, is bad about pain?
Very interesting question. I'll have a go at it, although these are 30-second thoughts: Pain is a warning system, very strongly correlated with damage and/or danger of death. Damage is bad, hence when we feel pain we want to stop whatever is causing damage; this has the incidental side effect (usually) of stopping the pain as well, so it feels as though we want to get rid of the pain - in other words, it feels as though the pain is bad, although what we really want is to stop the damage. A fitness-maximiser would want to stop the damage without the intervening step of pain.
With that said, though, I appear to have moved the question without really resolving it, because why is damage bad? Why is death bad? I don't think these can be answered without appeal to the plain utility functions: DO NOT WANT. So at best I've resolved the problem with masochism (edit to add: as a counterexample to people wanting to avoid pain), in that it's a rare BDSM scene which intentionally inflicts actual damage - piercings, at most. Accidents do happen, but intentional damage is very rare.
In my not terribly extensive experience with BDSM scene, I found that people who like pain like it extremely selectively - only right amount of it, of particular kind, and in sexual context. They avoid unpleasant experiences and pain outside this narrow context just like everyone else.