So it was that, when God destroyed the cities of the valley, God remembered Abraham and sent Lot out of the midst of the overthrow when he overthrew the cities in which Lot had lived.
God was not obligated to do what the text simply summarizes here. But He graciously rescued Lot, who never learned what it meant to live in the world but not live for the world. God's grace has been prominent throughout His covenant with Abraham, and it spills over into the life of Abraham's nephew. The whole episode with the destruction of the cities of the plain was to show that God will ultimately judge sin. The city of Sodom was so wicked that not even Lot's influence made any visible impact. When Lot and his family are rescued, it is because the first real "sin city" was being obliterated. And there are not even ruins left to speak of.
The focus of the story is tragic from a human point of view. Lot gave in to the lust of the eyes by living within view of Sodom, then he moved into the city and should have learned his lesson when his uncle rescued him. But by the time God checks out the wickedness of the city, Lot has become an elder in the city gates. It is at that point that he could have had great influence. But he was more influenced by the city than he was an influence in the city -- the details of the story point this out: he offered his own daughters to the deviant cries outside his door... he later allows himself to be made drunk by his own daughters and unknowingly impregnates them.
But the story is powerfully full of grace from God's perspective. God remembered His covenant with Abraham. He honored the gist of His conversation with the old man on the road to Sodom. He spared the slim sliver of righteousness that was there: Lot, his wife, and his two daughters. This was God being gracious, even in the midst of His wrath and righteous judgment. It is awesome in the truest sense, most reverential sense, of the word.