Superstition survives because it serves a function. Most generally, I suspect, the function is to predict and help us avoid bad things. How does a superstition begin, though? One possible explanation is that people take extraordinarily biased samples of their state of well being. That is, they tend to remember most clearly exceptional moments in their life, and they correlate these with subsequent events. These become a cause and effect pair, but the correlation is often wrong because of the exceptional nature of the sample.
Example #1: A person's health waxes and wanes. When the person seeks medical help, especially when they seek off-beat or alternative medical help, it is when they are feeling especially bad. Because their ailments wax and wane, we expect that they will be feeling better in the immediately following period. Therefore the person is likely to correlate the treatment to improving health through Post Hoc reasoning and because they are already optimistic regarding the treatment.
Example #2: A person's fortunes wax and wane. When a person is at the pinnacle of success, or when they are especially fortunate, they are also likely to brag about it. Of course, they often "knock on wood" to avoid being jinxed. But the pinnacle of success, or great fortune is a singular and unusual event. We expect that in the time period immediately following, their fortunes will decline. However, through Post Hoc thinking they will correlate the bragging and subsequent decline in fortune.
There are two steps to generating a superstition, here. First, the "sample" occurs at an unusual time period. The sample is biased. Second, Post Hoc thinking links effect to cause.