The problem with the just world hypothesis is that the reasoning is circular. Bad things happen to bad people. But that also means that, if something bad happened to you, you must be a bad person. The just world hypothesis often quickly devolves into victim blaming.
If you'd like to see real-world examples of the just world hypothesis, check out the comments section on pretty much any news story. Just don't feed the trolls. Really, don't.
This topic was introduced by Melvin J. Lerner, who has contributed a great deal of research and scholarship into the study of justice. He first made his observations during clinical training; though Lerner's PhD is in social psychology, he completed post-doctoral training in clinical psychology. He noticed that his fellow therapists often blamed mental patients for their own suffering. He conducted additional research into the topic, and in addition to articles, published a book detailing his various studies on the just world hypothesis. Unfortunately that book appears to be out of print, but if you happen to find it at a used book store or library, it's an excellent - though disheartening - read.
Why do people engage in this cognitive fallacy? As I've said before, people try to organize their world to bring order from chaos. We don't like thinking that events are random, and we see ourselves as the star in a story, with themes, plots, and subplots. We strive for consistency - in our own identity as well as in others. And we engage in a variety of cognitive fallacies to protect ourselves emotionally from the horrors of the world. We believe that bad things do happen, but they won't happen to us, often referred to as the delusion of invincibility. And we take this a step farther, in order to preserve our delusion of consistency and order in the world, by believing the world is just. In fact, Lerner and his collaborator Miller put it best:
"Individuals have a need to believe that they live in a world where people generally get what they deserve."This is a comforting and understandable belief. But as with many cognitive tendencies, it becomes twisted and dangerous, when we begin applying that belief to rationalize the suffering of others.
It's important to note that not everyone engages in this fallacy. Even in Lerner's studies, there were instances where people offered to help those in need and did not engage in victim blaming. So it is possible to break out of this delusion.