The Super Bowl is coming up, but did you jinx your team?
There's a NY Times article on such superstitions, who has them, when we acquire them, and how they can be good for us.
I think an aspect that this article ignores is inconsistent reward. Superstitions can arise even when they aren't consistently rewarded. B.F. Skinner famously studied this, and has been studied since, revealing that, while consistent reward yields more consistent behavior, superstitions persist when reward is inconsistent. Gambling is often used as an example of this phenomenon in humans, many have ritual numbers, seats, trinkets, or motions while gambling.
I have no doubt that prayer works the same way. Many people are convinced it works based on their preference for memories of times when prayer worked. While most of us know our ritualized behaviors don't offer us any better "luck" in life, we are often compelled to continue them. Call it a prayer or a wish, magic or god; belief in the super-natural is persistent across all of human existence, despite much evidence to the contrary.
So, despite my atheist convictions, I still cross my fingers and put on my jersey when I go to a game, with hopes that perhaps this time my luck will change.