I taught this to my boy recently. It is purely a result of my experiments, so maybe there is a better way.
First, the horse has to be able to yield his hind end and his shoulder to rhythmical, gradual pressure. Next, I stood by the middle of his barrel, holding the lead rope in one hand and with the other (using a crop) I reached over his back and tapped lightly (first - not touching him at all, just swinging the crop, then touching him) his hip to encourage to move the hip towards me. In case of trying to go forwards, I blocked the movement with the halter and calmly repeated the cue to move hip towards me. My boy sidepasses away from me very well from the ground, so he understood instantly what I was asking for, but, in case a horse gets confued and tries just moving the hip, tapping the shoulder might also be needed. One step is enough to begin with and, after that, it should build up quickly.
I have come a long way, to surrender my shadow to the shadow of my horse.