Horses are social, herd animals, though they're not as picky about who can belong in the pack as some canines are. They have a definite hierarchy in a herd, which is why stallions are the most problematical for humans to control. As to the running--they're born to do it. Prolly has something to do from back in the times when only the fastest escaped the wolves. They can be empathic, forming extra-close bonds with humans.
Racing, now--I can guarantee it's not done for the benefit of the horses, but I do believe there are some who enjoy it. There are a lot more protections for the horses now than in former years, but yes, they still get whipped. But--and I'm not saying there are NO jockeys who whip causing injuries--mostly it starts out as stinging (not cutting into the skin), and most horses learn pretty quickly to transfer the response to a sting of the whip to being lightly touched by the whip. By far, most of the riding signals are done by the jockey's hands and legs; use of the whip is reserved for the home stretch. If then.