This wouldn't be so apt if it didn't bring back a raft of bad memories, those days I used to go to the races, and back all of the wrong horses.

I had a knack, you see, of picking horses that fell over, or came dead last.

Perhaps that's another of those sayings, dead last, with a very obvious meaning.  Dead!  Last!

But…

In the modern vernacular, flogging a dead horse is like spending further time on something in which the outcome is already classed as a complete waste of time.

However…

Back in the old days, the dead horse referred to the first month's wages when working aboard a ship, usually paid for before you stepped on board the ship.  At the end of the first month, the theoretical dead horse was tossed overboard symbolically, and thereafter you were paid.

It still didn't make sense to me that someone would tell me I was flogging a dead horse, until I realized, one day, the lesson to be learned was never to get paid in advance.