Its really pretty simple. Start out in hand, halter or bridle your choice. Grab a pocketful of treats and a dressage whip. If you are not a treat giver, that's okay a good pat for a reward also does the trick.
Stick your horse against a wall, like the side of your arena/roundpen.
Start out and just gently tap your horse's leg with the whip anywhere where you get the most response. My horse made the most response on the front of her knee cap. If your horse is a bit on the dull side, you keep tapping or tap harder until he motions to move his leg. (Even the slightest bit) then reward with a pat or a treat.
One you have established that a tap means to pick up his leg, then you can start adding in the walk. Stay at your horse's head, and tap his belly to motion him forward. Watch his front legs and count every 4 steps he stops on his outside leg, and you tap his inside leg up. Walk immediately and reward. Repeat until he gets the point. Once you can do that both sides, then you can start alternating. 3 or 4 steps right leg, 3 or 4 steps left leg.
The main important part is that your horse keep walking, and keep the forward movement. Otherwise, his back end will get camped out behind him and he wont have the balance to lift his front legs. So the aid to walk immediately after the leg lift is super important.
The more your horse understand that he lifts a leg, then walks, then lifts the other, you can ask for the alternating every step.
My horse was pretty funny, she'd do it all on her own just to get a treat. Which was okay in the beginning, and then as you progress you start to train when its okay to do it, and when it's not.
Let me know how it goes and if you have any questions!!!