In chapter 18, God and two angels show up at Father of Multitude's place in human form, and Father of Multitudes feeds them calf, curds and milk, and bread cakes. God repeats the prediction that Princess will bear a son, and Princess laughs at the idea because she is too old. For me the money quote is in verse 18 where God declares that Father of Multitudes will become a populous nation and "in him all the nations of the earth will be blessed". Of course, Father of Multitudes is expected to bring up his children to do righteousness and justice.
God and his angels are on their way to Sodom and Gomorrah to check out rumours about the wickedness of the denizens of those cities and to destroy them if it turns out that they are as wicked as they have heard. Father of Multitudes pleads with God to spare the cities if 500 righteous people may be found in them as it would be unjust to kill the righteous and wicked alike. God agrees, and Father of Multitudes bargains Him down to ten righteous people. As it turns out, there weren't even five righteous people, not even infants or toddlers. Just Lot, his wife and their two daughters, so they were six righteous persons short.
In chapter 19, the two angels arrive at Sodom where Lot meets them and invites them to stay in his house. Presumably God is elsewhere conducting His investigation. Then the Sodomite men show up.
SODOMITES: "Hey, Lot, send out those guys so we can sodomize 'em. We're Sodomites, and that's how we roll."
LOT: "That's wicked. Take my virgin daughters instead and have your way with them. These men are my guests and under my protection."
SODOMITES: "That damned foreigner! Who is he to judge the matter? Let's sodomize him, too."
We'll encounter a similar story later on in the Bible, where women are offered up as substitutes for male guests for gang rape.
The angels rescue Lot and warn him to flee with his family. His prospective sons-in-law refuse to go because they think he's kidding, so just the four of them escape. Mrs Lot turns around to look at the hail of fire and brimstone falling on the cities and turns into a pillar of salt. It's unclear whether this phenomenon was a side effect of the rain of fire or punishment for failing to heed the warning not to look back. I prefer to think it was the former.
Lot and his daughters end up living in a cave. The daughters get him drunk, have sex with him, conceive and bear sons Moab and Ammon, the putative progenitors of the Moabites and Ammonites. I don't know if this was supposed to be an insult to those ethnicities.
Here's how I figure this part of the story came about. The cities of the Jordan Valley were destroyed in some spectacular cataclysmic event, and storytellers attributed it to punishment for wickedness. They put Father of Multitudes and his nephew into the story as a chance to show their concern for justice and their righteousness. There may have been a geologic formation that had the shape of a woman, and this was explained as Lot's unfortunate wife. Given the concept of God that was developing, it would have been very natural to attribute a catastophe to the hand of God. And since God was beginning to be understood as the "judge of the world", it was natural to assume that wickedness was the motivating factor. After all, God wouldn't let cities be destroyed for no reason, would he? If bad things happen to you, it must be because you deserve it.
Note also that God doesn't seem to have developed omniscience at this point since He has to investigate the outcry over the cities of the valley and doesn't know if there are ten righteous people. He also doesn't appear to know what He is going to do. I wonder if Melchizedek was destroyed along with the wicked.