A pretext is an official reason that is meant to guise the true reason behind an action. For example, a young man may see his love under the pretext of visiting her parents, or of helping her with some work. The official thing is usually not completely fake and has a good justification for itself, but there is a hidden ulterior motive to it, or at least a secretly welcome side-effect.
Spankings under pretext
A spanking can be given under the pretext of the duty of administering a necessary punishment, while the ulterior reason is something else - to have an outlet for one's anger, frustration, or worries, the secret enjoyment of power and dominance, a sadistic liking for inflicting pain, or a hidden erotic/sexual reason.
Even among two spankophiles, a spanking can be given under some disciplinary pretext, e.g. for bratting. Both partners know that it is a pretext, but for the sake of more fun through roleplay, the spanker pretends to be angry and the spankee pretends to not want the spanking. The "punishment" is perfectly consensual but is given a feel of non-consensuality for greater enjoyment.
Related things under pretext
A spanker may also do erotic/sensual actions under some pretext, for example the baring of the spankee's buttocks can have an erotic reason but is done under the pretext of making the spanking more painful. The spanker can rub and massage the spankee's bottom during and/or after the spanking under the pretext of soothing the pain. Hugging and kissing after a spanking can be done under the pretext of reassuring the spankee, apologizing, or making up.
Likewise, a bath or shower can be given, a scrubbing, or the removal of body and pubic hair, all under the pretext of hygiene, with an erotic side-reason. An enema, too, can be given under a disciplinary, hygienic or medical pretext. A person may be made to wear a chastity belt under the pretext of discipline and dicouraging sexual activity, while the true reason is to enhance sexual/erotic awareness.