Let's say there actually would have been 50 (or 45, or 40...) righteous people in Sedom. Would Hashem have destroyed the city without Avraham's tefillah but saved it due to his tefillah? Was Avraham asking for something that was undeserved?
1 Answer
There are situations in which God delays performing an action until man prays for it. See for example Bereshis 2:5 with Rashi's commentary, that God waited for Adam's prayer before causing the vegetation to sprout in the Garden of Eden. An additional example is when God decided to destroy the Jewish people, he says to Moses "Now leave me alone and my anger will burn against them." Shmos 32:10, see Rashi's commentary where he states that God said this to teach Moses that this was his opportunity to pray. It could be that the same would have been the case with Avraham, God left it up to his prayer.