The player cannot enter the Local Horse Race during the first year, as your horse will not yet be old enough to participate. Once your horse has grown up, you can enter the horse race yourself.
While you may not participate in your first year, you can still watch and place bets. All horses have odds on winning and will pay out according to those odds. To bet, you need to first buy tokens off the Mayor, which you can then use to bet on a horse. You also use the tokens to buy prizes, one of which is a Power Berry. You can keep your tokens after the event has ended, and they will not take up inventory space.
The race is very similar to the swimming contest, as in both contests you need to balance stamina and speed. A good balance will keep your horse ahead of the others.