Technically, spanking is considered part of the sadomasochism (sadism and masochism) and Domination elements of BDSM.
Why do people like being spanked? There is more to it than just the feeling of pain one feels. The area of the buttocks that meets the back of the thigh is considered an erogenous zone and if contact is made with the right amount of pressure and frequency, it can result in arousal for many people. Spanking though elicits a whole array of psychological responses as well. It can take us back to our childhood, make us feel loved or humiliated, which many people find a turn on. It can also be a part of domination and submission with the partner administering the spankings taking total control. Whatever it is that we enjoy about spanking, it’s a common fetish.