You really don't want to get kicked by a horse - they have a lot of strength and those hooves are hard.
Why would a horse kick its handler?
A horse kicks another horse, in general, to warn them. Unfortunately, even horses can be injured by a kick (or, in rare cases killed). Smaller humans are much more at risk.
Kicking is, thus, considered a particularly dangerous habit or vice. Generally, they threaten to kick because they really, really don't want to do what you're asking and are trying to intimidate you into giving up and letting them alone. Horses normally kick backwards with their back legs. Mules can actually hit you with their back legs - when you're standing in front of them. Occasionally a horse will try to kick forwards like that, called cow kicking, but they generally can't get much force behind it.
The other reason a horse may kick out is if they're startled by something behind them, which is why novice riders are told never to walk behind a horse.