I believe the horse known as John Henry has 39 documented wins, and by far is the horse with the most race wins.Kingston won 89 races when he retired at age 10 in 1894. That's the record to this day.
It's either randomly drawn, or the names are randomly drawn and the trainers get to pick what position they want in the order their horse's name is drawn.