In days of old, before toilet paper and the Sears Roebuck catalog, a stick was used to wipe your rear clean in the outhouse. You had to be sure you grabbed the clean end of the stick, and not the shit end.
It was dark, and my dirty hand showed I had grabbed the shit end of the stick.
My grandfather grew up in poverty in a company owned coal mining town where he was born in 1895. He yold me about a game they played called the fox and the hounds whenever a new kid came to town. One kid was the fox. He carried a stick between his legs to simulate a tail. The object was for the hounds to chase the fox and capture him by grabbing his tail. They always let the new kid win. Unbeknownst to him the had dipped the end of the stick in the muck of an outhouse. Clearly getting the shit end of the stick was getting a bad and unanticipated result.
Short-hand for the word floccinaucinihilipilification, meaning the estimation of something as valueless (encountered mainly as an example of one of the longest words in the English language).