NEVER discipline a horse when teaching the changes. If they get it wrong just try again, and ignore the mistake. Reward the smallest try on their side. Horses can get excited, nervous and forward when they learn changes and it's important that they never have any association of stress or tension with changes if you want a relaxed, smooth change eventually 👍
When you're training your horse to change it can be easy to let them fall inside and lengthen when asking for the change. When going up a diagonal or roll back where you're about to ask for the change, make sure you have your horse well collected and on the bit- make sure you prepare them on the corner, having them with good impulsion. When you ask for the change don't let your horse get long and flat- make sure they're between the hand and leg with lots of energy. Signal with your legs to do the change, with the inside leg on the girth and the outside leg further back- and make sure you keep using your seat. For the first few times, it might help to try the changes without stirrups as you will use your seat more and your horse is more likely to listen. Don't turn or let your horse fall inside until the change has been done; keep them Straight.
As the person said above, it's also a good idea to ask for the change in the center of a figure of eight, using a small cross pole or ground pole in which you can ask for the change over.
Try galloping over a pole and asking for the change as you're over it. Another way is to do a galloping to trot transition then transition to the gallop again, on the opposite lead, then try to shorten the ammount of trot strides between the gallop until the horse is doing it almost instantly.