Sometimes a horse will just collapse - and most of the time? Most of the time it's sleep deprivation. Although horses mostly sleep standing up, they need to lie down to dream. If they don't do this at least once every two weeks (normally, they do it every two days) then they can get narcoleptic.
Why do horses get sleep deprived? Anxiety is the most common reason - the horse simply never feels secure enough to lie down to sleep. This is more common in dominant animals (They don't want to leave anyone else watching the herd) and in animals kept completely alone. Other reasons for sleep deprivation in horses include noise pollution (just as with some humans), sleep terrors/nightmares (We don't know what horses dream, but we can see them freak out), muscle or other conditions that make it painful for the horse to lie down and/or get up or being kept in a stall which is too small. In some cases, the departure of the lead mare can cause the entire herd to be sleep deprived until the hierarchy sorts itself out.
Other reasons for horses collapsing include heart problems or narcolepsy.
Sleep deprivation in horses is most often treated with anti-anxiety drugs, but melatonin can help some.