Why did the malachim sent to rescue Lot and destroy Sdom stop off at Avraham's home first? The malach sent to destroy Sedom played no role in the story until later -- why did he come along for the visit?
The Midrash comments, "Matzasi David avdi," that David haMelech was found / discovered by Hashem in Sedom. It was through the illicit relationship of Lot and his daughters that Amon and Moav were born, which led to Rus, which led to David haMelech. Thus the genes of David haMelech, the genes of the lineage of Moshiach, have their roots in Lot, mayor, and, in the merit of those genes, sole survivor of the city of Sdom.
The gemara (Yevamos 77) tells us that not everyone accepted David. Doeg ha'Edomi taught that the din of, "Lo yavi Amoni u'Moavi b'kahal Hashem," (Devarim 23) means that the Torah permanently excludes descendants of Amon and Moav from Klal Yisrael. Avner ben Ner, however, argued that the pasuk can be darshened, "Moavi" -- v'lo Moavis"; only male Moavites are barred, but females converts are accepted. Doeg challenged: If so, why not similarly darshen, "Mitzri -- v'lo Mitzris," that only male Mitzri'im are barred from marrying into Klal Yisrael, but not females? Just as this derasha is wrong, so too, the derasha "Moavi v'lo Moavis" is wrong. Avner answered that the case of Amon and Moav is different. Here the Torah tells us exactly why they are excluded -- "Al asher lo kidmu eschem b'lechem ub'mayim" -- because they did not show any hospitality to Klal Yisrael when they needed food and drink. Who normally comes out to serve food and drink to strangers? Men, not women. Therefore, said Avner, the prohibition against marrying Moavite converts applies only to men, not to women.
The malach sent to destroy Sdom and the malach sent to rescue Lot had to come to Avraham's home to hear his answer to one question -- "Ayeh Sarah ishtecha?" Where is Sarah your wife? Why is she not out serving us as well? Avraham responded that she is in the tent; as Rashi explains, Avraham told them that the trait of modesty dictated that only he, not his wife, come out to serve the strange guests. A psak din: Tzniyus trumps hachnasas orchim! Without this psak of Avraham, the malachim could not do their job. It was this psak that justified the Moavi women not coming out to serve Klal Yisrael, which in turn justified David haMelech's lineage, which in turn is why Lot deserved to be saved.
According to another opinion in Chazal the angels asked Avraham where Sarah was because they wanted to give her a taste from the kos she bracha. There was no bread served at this meal -- as Rashi explains, the bread became tamei because Sarah became a nidah -- so what kos shel bracha are Chaza; talking about? The Lev Simcha explains that the kos shel bracha is the kos from bentching over the future seudas Livyasam. Chazal (Pesacim 119b) tell us that the kos shel bracha will be passed from tzadik to tzadik, from Avraham to Yitzchak to Ya'akov etc. and each one will have a reason why he should not lead bentching. Avraham will decline because he had Yishmael; Yitzchak will decline because he had Eisav, etc. Finally, the kos will get to David haMelech and he will accept it. The tzenius of Sarah which provided the justification for the derasha of "Moavi v'lo Moavis," paving the way for the acceptance of David haMelech, is rewarded with a taste of the future kos shel bracha that only David haMelech can accept at that seudah of Livyasan in the time of future geulah.