This is how I taught my horse, I don't know if it's right or not, but she's extremely automatic now so... I must've done something right!
Make sure you have a solid canter cue before you teach changes. Mine is outside leg, inside rein. Also, make sure you have a fairly balanced horse; doing lots of circles helps.
Before the flying change, I started with the simple change. Transitions on the rail REALLY helps prepare a horse for simple changes. A solid canter cue and instantaneous responses are key. Once your horse has fully understood the cue for the canter and doesn't think twice about going into the canter or halting from a canter, then you can introduce the simple change. I really like introducing changes with 20 meter circles. I canter around to the middle of the ring, ask for a halt at 'X', then ask for the other lead and go the opposite direction.
After you've mastered simple changes, you can move to the flying change. Again, have your horse going on a 20 meter circle with a fair amount of momentum. When I started teaching her, I'd do at least one full circle, then as I came to the center for the second one, I'd continue to ride like I was going to do another circle the same way, then at last minute, I'd turn the other way. At the same time, I'd give her the cue for the other lead. With such a sharp turn, the only way to keep from falling over is to change the lead. A few lessons doing this, and the horse will begin to understand the mechanics of the flying lead change.
After the horse has mastered its changes at the 20 meter figure 8, try doing them with 3 loop serpentines and even 4 loop. That would make them have to do smaller half circles and gain balance, and do many changes frequently.
I do these exercises every time I ride and my mare is really good at her changes now.
Another really important thing to keep in mind is your
balance. If you're leaning into the turn, it'll be harder for your horse to pick up the correct lead. Make sure you are sitting still, and in the center of your horse's back. Make sure your commands are firm and clear.
Hope that helps!