Before Yetziat Mitzrayim, Hashem caused the Jews to find favor in the eyes of the Egyptians. A simple reason for this is so that the Egyptians would readily offer their gold and silver to Bnei Yisrael so that they would leave with great wealth, in fulfillment of the Brit Bein HaBetarim. But if that was Hashem's intention, why not cause the Egyptians to give over their wealth out of fear? Why did He have to engineer events so that the Egyptians gave the Jews their wealth willingly?
Throughout our Galut, we have been mocked, hated, and killed by the nations of the world. We have had to ignore those who deride us because of our service to Hashem. There is a danger, however, that this will be seen as the way things should be if we are good Jews. The Torah teaches us that the opposite is true: "Learn and observe [the Torah], for it is your wisdom and understanding in the eyes of the nations, who will hear of all these laws and proclaim that this is truly a great, wise, and understanding nation" (Devarim 4:6). The Torah attaches importance to the respect given us by the nations of the world. This acknowledgment of God by the gentiles is so important that all of the miracles of the splitting of the Yam Suf were performed in order that the Egyptians should recognize Hashem (Cf. Shemot 7:5). The Ibn Ezra adds that the Egyptians referred to were those who drowned. Thus, the splitting of the sea was warranted even for the few seconds of recognition of God by the drowning Egyptians. Olam HaBa is not limited to Jews; righteous gentiles also have a portion therein (see Rambam Hilchot Melachim 8:11).
Halacha reflects this idea. We are forbidden to make a Chilul Hashem by giving the gentiles reason to criticize us for bad conduct. Kiddush Hashem is a piece of the Mitzvah of Ahavat Hashem, loving God. As Jews, we must command the respect and favor of the nations of the world in order to fill the world with His glory (Cf. BeMidbar 14:21). That occurs, teaches Rashi, only when we fulfill the Mitzvot properly. A Mitzvah fulfilled properly is beautiful and can command only respect and admiration. If we fail to perform the Mitzvot properly, we will be considered fools, for the Mitzvah that is performed improperly creates ridicule against us. The scorn of the nations of the world is not a sign of our perfection, but rather a sign that something is lacking in our service of Hashem. The idea that "It is a Halacha: Eisav hates Yaakov" (Sifrei BeHaalotecha 69, cited by Rashi Bereishit 33:4 s.v. VaYchabekeihu) guards us against assimilation, but when we fulfill our role properly, the entire world will want to serve Hashem. Prior to our first redemption - the model of the final redemption to come - Hashem brought us favor in the Egyptians' eyes so that we would not forget this ideal. The Egyptians readily gave us vessels of gold and silver to improve our service to Hashem in the desert. The clothing they gave us represented the honor and glory in which they wished to dress us. And so it will be in the final redemption.