Interesting question, Squirrel - I'm not certain how hypnosis works for pain relief, and I've never used it.
However, there are a few possibilities: firstly, the brain has a tremendous influence on the body - eg you can make your mouth water by thinking about food, and every time I even think about going to the dentist I get sweaty palms and my heart rate goes up. Conversely, there is an increase in the body's natural painkillers, endorphins, when you're feeling good and it's possible that hypnosis builds on this type of response, and positive thoughts/relaxation reduce the release of stress hormones and increase the release of endorphins.
Another explanation is that if we feel that we are in control of a situation, it makes it easier to cope with. The pain is still there, but if it is suggested to the patient that they are in control and that they can deal with it, then it does not bother them as much. Patients who are taught things to do to relieve pain themselves after surgery have lower need for painkillers than those who those who are not taught what to do.
Another means by which hypnosis may help is distraction.
The meaning of pain is also important; studies of wounded soldiers have shown that they may not complain of pain as much as you'd expect, because injury means that they will be removed from a dangerous situation. It is possible that under hypnosis it may be suggested that the pain is unimportant, or that it isn't pain but a different sensation eg heat - I've used this "conversion" strategy quite effectively when I've had pain, although I wasn't hypnotised.