Before the plague of hail, Hashem commanded Moshe to add a few words of admonishment when he forewarns Pharaoh about the impending plague. "For I could have now sent out My hand and smitten you along with the [animals during the plague of] pestilence and you would have been wiped out from the earth. However, it is for this reason that I have kept you alive; so that you may behold My strength and recount [the greatness of] My name throughout the land" (Shemos 9, 15-16).
Rav Wolbe (Shiurei Chumash) explains the idea conveyed in these two pesukim. Chazal relate that Hashem was asked for what purpose were wicked people created. He answered, that fruit trees were created for the purpose of providing fruit and non fruit bearing trees were created to provide people with wood for building and for heat. Likewise, the righteous fulfill the Torah and their good deeds provide the world with "fruit". The wicked do not provide the world with fruit, but nevertheless, they serve another important purpose. They are agents through whom Hashem's glory is revealed to the world.
The righteous and wicked are both means of revealing Hashem's glory in the world. This is accomplished through the deeds of the righteous (their fruit) and the punishments meted out to the wicked. A person is given numerous tools (e.g. body, house, money, etc.) to serve Hashem and glorify His Name. If he uses these tools toward this objective, then he fulfills his purpose in life. However, if he decides not to use his tools toward this end, then he and everything he owns becomes a tool in the hands of Hashem to bring about the desired results - the glory of Heaven. Hence, Pharaoh was kept alive, "to behold Hashem's strength and recount His greatness throughout the land."
There were those who purported that the Third Reich would last a thousand years, but it lasted a mere eleven years - "to destroy them forever" (Tehillim 92). In contrast, the righteous, "will flourish like a date palm and will grow tall like a cedar. To show that the ways of Hashem are just" (ibid). The destruction of the wicked and the flourishing of the righteous both demonstrate that Hashem's ways are just. The difference is in the manner that it is accomplished.
We constantly decide how to use the tools given to us. Should I help my neighbor or instead read the paper? Should I give the money to tzeddaka or should I spend it on trivial things? Every situation gives us an opportunity to glorify Hashem's name and fulfill the purpose for which we were put here on earth.