There has been a wealth of research that shows that given several equally good (or gross) options, people tend to choose the middle one. Psychologists call this “centrality preference.”
That means most people who came before you also chose the middle stalls and avoided the sides. Which ends up leaving the side stalls a bit less nasty.
In a paper published in 1995 in the journal Psychological Science, the psychologist Nicholas Christenfeld presented a series of short experiments in centrality preference. He examined the habits of beachgoers in a public washroom in California.
Instead of standing there and looking awkwardly impolite, Christenfeld examined toilet paper use. He enlisted the help of the bathroom’s custodian, who kept track of how often toilet paper needed changing in each of the four stalls for 10 weeks. The result, 60% of finished rolls came from the middle stalls, as opposed to 40% that came from the end stalls.
While we can assume using the numbers that the middle stalls are dirtier, there’s a caveat. It is possible that the few who use the end stalls make more of a mess, and because of the less traffic, the custodians may chose to clean the end stalls less frequently.