Someone who's on the nod is either asleep or falling asleep, especially when the shouldn't or are are in a position unusual for sleep, like sitting or standing.
When a horse runs, its head moves backwards and forwards alternately - in horse racing, if 2 horses cross the line together the one whose head happens to be going forward often wins and is said to win 'on the nod'.