Research has shown that patting is actually stimulating for the horse, and activates their stress response. That's why if you lean forward and pat your horse during a ride, they usually speed up.
Patting horses is something we've all done, but the science says stroking or scratching is much more calming and rewarding as it mimics their natural behaviour - when is the last time you saw horses pat each other?