I have a piece of trivia that should help you to understand this a bit. Currently, the most popular "job" among horses is no longer pulling heavy stuff, carts, people, messages and so on. In modern times, acting is the most popular job for horses. And if that is what they do the most, then they are bound to be good at it.
In older times, it was probably like with animals in circus - they are beaten and hurt until they obey your command. Such practices led to situations like this: during the shooting of Ben-Hur in 1924, around 150 horses died. Later, things started to get a bit better, but things like this still happened:
They would drill holes in the front horseshoes and run a wire up to the reins,” says Dent. “Then when the horse’s front feet were up mid-gallop the rider would pull and the horse’s feet would stay up. Or they’d gallop horses into pits that were about eight feet deep.
According to this source, nowadays, it depends on finding the right horse, which is athletic and fearless and they just gradually train it to fall down on command and the process could be compared to teaching a dog some tricks.