A good electric fence will keep in 99.9% of horses, problem is many people don't build a good electric fence. That .1% that wont stay in good electric fences need you to spend a lot of money on a very solid fence or sold.
Many horses have learned to go through electric fences just because it was never hot enough to teach proper respect. Most can rehab with a darn good fence, some you can't. But then some learn to shove another horse through the fence first so they can get out. I grew up on a farm and dad had one rule when it came to animals, if they refuse to stay in a fence get rid of them.
Does and Don'ts of good electric fence:
-Stay away from fence chargers that only are good for a couple miles, they are weak and tend to not last long. You want, at a minimum, a 20-25 mile fence charger. They are strong enough that animals respect them and last a good long time.
-Unless you have no outlet available, stay away from battery and solar chargers. They just are not as strong over time and definitely don't handle weeds as well.
-Stay away from tape. Yeah it's easy to see but those fine strands just don't carry the voltage and then when you tie a not in a break you lose even more. They also rot in the sun so after a couple years they break when it's windy. Use solid wire instead, then tie some streamers to it. Streamers let them see where the fence is when the fence is new. Once they know where a fence is they are no longer needed.
-You have to have a good ground, without one you are wasting your time.
-Run 3 wires. Top and bottom are hot with middle tied to ground, that gives them a very rude wake up call when touched.
-Keep fence grass and weed free. Walk your fence at least once a week to inspect it and remove vegetation. I normally spray roundup all the way around.
-Get yourself a fence tester and use it.
-Check your insulators. Spiders, dirt and old age can all allow your wire to short across to the pole.
-Once you have a good strong fence, get your horse shocked by it. Have to be careful doing this as you don't want them to jump on you but do it. You want instant respect for that fence.
-Maintenance, maintenance, maintenance. They'll try the fence along just to make sure it's still hot. If it's not they'll go right through it, this is why you don't want a charger that weakens over time.