To prevent your horse from kicking out, you need a friend on another horse and that friend should be a good rider and horse person. The exercises I would do can be dangerous if you’re being helped by a nervous or unaware horse person. Also, this is a very hard problem to work at on the trail, so I recommend you start trying to fix it in an arena or a field.
Before starting, keep in mind that very seldom does a horse kick out with no warning whatsoever. Usually, a horse will lower her head and pin her ears back, then kick. There might not be much warning, but there’s usually some.
Sit on your horse at a stand still and have your friend ride their horse back and forth in front of you, staying about 10 feet or so away. This way, your friend’s horse is too far away for your horse to reach out to bite or kick. If your horse has no reaction, gradually have your friend ride closer and on either side of you, but not behind you, where they would be in kicking range.
While your friend is riding close by, you need to be focused on your horse’s head and ears. When her ears go back, she will automatically lower her head at the same time. When she lowers her head, immediately lift one rein straight up. Your timing has to be nearly perfect – as her head is going down, your rein needs to be going up at the exact same moment so she gets a bump from the bridle rein, but she will think she did it to herself. Because the lowering of the head and the pinning of the ears comes before a horse kicks out, you’re going to focus on correcting that instead of waiting for her to actually kick.
Have your friend ride away and then come back and keep repeating the exercise. Have them come closer and eventually have them ride all the way around your horse. When they ride around behind, they need to be far enough back that your horse couldn’t reach them if she did kick. Every time your horse lowers her head and/or pins her ears, immediately bump straight up with one rein as a correction.
Once your horse stops pinning her ears when doing this drill, start riding her at a walk and have your friend trot big circles around her and ride back and forth in front of her as you’re riding. Again, if her head goes down, bump straight up. You want her to ignore the other horse. Once she starts ignoring other horses out on the trail, she’s not going to want to kick at them.
If she does kick out at any point, pull one rein and yield the hindquarters very quickly in one full circle, or use one rein and pull your horse around in one very small and tight turn as a correction.
After several sessions, she will learn that any show of aggression to other horses is not allowed when you’re on her back. From then on, when you’re on the trail always take note of her expression when another horse is coming up behind her. If the ears go back, bump that one rein straight up.