One of the all-encompassing themes of Judaism is something called Kiddush Hashem. This phrase is often translated as "sanctifying the Name of God." Or, in plain English, good PR For God.
By PR, we do not mean that everyone is pleased with God necessarily, but that our thoughts, speech, and actions personify that there is an Infinite Being who is beyond the limits of our world yet at the core of every detail of it—that God is apparent.
Distinguishing Honor
Now, there is a well-known idea in Judaism to honor one's parents. What is not as well-known is that if a parent states that he or she is willing to forgo that honor, the child does not have to do those things that are normally required under the laws of honoring parents.
Contrasting this, there are also laws that pertain to honoring a Jewish king. But, were a king to forgo the honor he has coming to him, according to Jewish law his honor would not be considered forgone. The reason for this is that the Jewish king is an international representative of the Jewish people, and the Jewish people are the international representative of God.
That is to say, the king's honor is not his own. Rather, the king's honor is a reflection of God's honor, and it is because of this that the king does not have the authority to forgo his honor—after all, it is God's honor, not his.
God's Representatives
Similarly, the Jewish people's honor is not their own. They, too, are representing and reflecting God in the world. If the Jewish people do the wrong thing, this creates a Chillul Hashem, a desecration of God's Name, the appearance that there is no God—bad PR for God—since their actions seem to imply Godlessness.
Thus, the Kiddush Hashem concept really encompasses all of Judaism. Judaism is all about bringing God-clarity and God-awareness to an unclear and unaware world, and, therefore, all positive deeds have an aspect of Kiddush Hashem attached to them, whereas all negative deeds have an aspect of Chillul Hashem attached to them.
When the Jewish people, whose mission it is to be a Light Unto The Nations, do the right thing, this brings good PR for God since their actions indicate a Godful world. But, if they mess up and do what is wrong, bad PR for God results, since the actions of those who were supposedly on a mission of God-embodiment are, themselves, acting in a manner that seems to indicate and exemplify a world that is Godless.
A Vengeful God
However, when we understand that Kiddush Hashem and Chillul Hashem are about God-awareness and God-perception—God-PR—Kiddush Hashem and Chillul Hashem come to be defined much more broadly. That is to say, there is another kind of Kiddush Hashem and another kind of Chillul Hashem.
Anything that occurs in the world that seems to imply that God is running the show is considered a Kiddush Hashem. Whereas, anything that occurs in the world that seems to imply that there is no God (or that God seems to lack the capacity or will to run the show) is considered a Chillul Hashem.
For example, if another nation attacks the Jewish people and nothing happens to that nation as a result, this is a grave blow to the world's perception of the "God of the Jews" running the show. After all, you would think the nation that is pushing God's agenda in the world would be protected. Or, at least something would happen to those who mess with this nation!
The result of such an uninhibited attack is added doubt in people's minds as well as society's subconscious about the existence of such an Infinite Being and/or His/Her/Its ability or willingness to run the show.
Here is where the concept of God's revenge comes in according to Judaism.
The idea of God's revenge is not similar to the human concept of revenge. The human concept of revenge occurs when someone refuses to lend me his or her hammer one day, and I therefore refuse to lend him or her my screwdriver the next day. The human concept of revenge is to focus on one's ego and bring suffering to another for the sole purpose that he suffers.
However, the idea behind God's revenge is that once something has occurred to bring down the state of God-awareness in the world, something must be done to rectify this move toward non-clarity. If God has been pushed down or pushed to the side, something must be done to bring God back to the center. For the achieving of human fulfillment and the world's ultimate purpose, there must be an increase in God-awareness by righting the wrong that brought the world to a greater state of God-confusion.
It is not about God being jealous or vengeful the way a flawed human being might. We only refer to it that way since that is how it initially appears to us. However, it is truly about fixing and building the state of God-consciousness for the purpose of the ultimate good being brought forth and actualized.