That's a very difficult question to answer; one I think that depends more on the opinion of the person answering it than it does on anything else. However, I can give you my take on how a patriarchal, ritualistic homicide might have been prevented.
One of the primary reasons that the lottery took place they way it did is because of the male-dominated society Shirley Jackson sets up in the short story. Women are subjugated, and there are many examples to this effect. Some of the men talk to their wives in a demeaning way, one man even saying to his wife, "shut up, Tessie."
Subjugation of women allowed men to control most parts of everyday life, including reproduction. According to an essay by Oehlschlaeger, the inherent structure of the lottery made it such that a woman with the largest family stood the best chance of not drawing the black dot.
It would seem to me that a patriarchy gone wrong, run rampant, if you will, coupled with mob ideology and ignorance were the primary factors that allowed the ritual to continue. Ignorance is presented in statements made by Old Man Warner regarding the connection between the lottery and the harvest, "Lottery in June, corn be heavy soon." In addition, most citizens of the town seemed to buy into the superstition and ritualism that fed the lottery. So how to prevent it... Education. Education and a willingness to accept change.