The Book of Esther is the ultimate story of God putting the cure before the disease. Everything that's a seeming disaster, in hindsight works out, so at the end of the story the Jewish people look back and see how incredible it all was. This is to illustrate that even the worst is really serving the will of God. Everything is not what it seems, which is why on Purim it is a custom to wear masks. Whatever bad had seemed to be happening by chance was, in fact, intricately planned for the good.
Nothing happens by accident.
There's a design to it all. This, in fact, sums up Jewish history. Just as in the story of Purim when it's over we look back and we see how everything fits into place. Nothing is by chance. Everything has a reason and God will make sure that even in the worst circumstances the Jews are always going to have a way out, so that they can accomplish their mission in this world.