After successfully helping Sodom to pull off an upset victory over the five kings, and to recover Sodom's captured property and prisoners (including Avraham's nephew Lot), Avraham gets an offer from Melech Sodom. The king of Sodom proposes, תן לי הנפש והרכוש קח לך, "Give me the people, and you can keep the goods." Avraham responds ה' קל עליון קונה שמים וארץ ואם אקח מכל אשר לך. "I have lifted my hand (in an oath) to God Most High, Possessor of Heaven and Earth! Not a thread nor a shoelace! I will not take anything that is yours!" This response is praised by the Gemara (Sotah 71a). As the Gemara relates, Rava teaches that in return for Avraham's turning down the king of Sodom, his children, will get the mitzvah of Techeilet, the blue threads of the Tzitzit, and the mitzvah of wearing Tefilin. These mitzvot, which involve the use of a thread or a strap, correspond to Avraham's commitment to accept not even "a thread nor a shoelace" from the king of Sodom.
Rashi (ibid. s.v. בשכר ואם מחוט ועד שרוך וסף) says that Am Yisrael got this merit because שהבריח עצמו מן הגזל, Avraham refused to be an accessory to theft. The Torah Temima asks what is so special about what Avraham did? There is no element of "theft" in this situation at all. The Gemara (Bava Metzia 22a) states that if one salvages stolen property, the property is his own and he need not return it to its original owner.
The Torah Temima answers that Avraham is not merely involved in returning war spoils, but engaged in an act of Kiddush Hashem, sanctifying God's name. Avraham is therefore particularly careful and stringent to create a favorable impression of God on the King of Sodom.
The Malbim explains that Avraham refuses any kind of material reward because he has already received the greatest possible reward. The world's recognition of the reality of God's providence and His hand in Avraham's victory over the five kings is reward enough for Avraham. As Avraham says in Pasuk 12, הרמתי ידי אל ה' קל עליון קנה שמים וארץ - "I lifted my hand to God, Possessor of Heaven and Earth." He makes sure that the king of Sodom knows that it is God who is the real victor in the war.
Therefore, the Torah Temima answers that Avraham's ultimate goal in winning the war with the five kings was to glorify Hashem's name, to make Him And His power known to the world. Even though he ordinarily could have kept the spoils of war for himself, in this case he could not. When one is given the opportunity to glorify God's name, he is required to return all lost objects, even when the original owner has given up hope of ever getting them back (see Choshen Mishpat 664:1). Therefore, says the Torah Temima, if Avraham had decided to keep the spoils, it indeed would have been as if he had committed theft. Rashi therefore explains that since Avraham had no part in this potential theft, his children merit the Mitzvot of wearing strings of Techeilet in their Tzitzit, and the straps of their Tefilin.
We learn from Avraham the extreme importance of leaving a favorable impression of God with our actions. In situations when we can make God "look good," we should do our utmost to come through.