Why did Hashem say "Lo Ashchis" regarding 45, and "Lo E'eseh" regarding 40 and 30, and Lo Ashchis regarding 20 and 10?
Da'as Zekenim, Hadar Zekenim, Rosh (verse 32): If there are 10 Tzadikim in every city, I will not punish at all. If there are nine and I must join Myself, I will not destroy, but I will afflict. If there are 10 in each of three or four cities (the majority), I will not punish at all [even the cities without Tzadikim]. If there are 10 Tzadikim in each of one or two cities (the minority), I will not destroy, but I will afflict.
Moshav Zekenim (verse 23): First Hashem said that He will not destroy [even] the Resha'im (if there are at least 45 Tzadikim). Later, He said that He will not do [only] to the Tzadikim (but He will destroy the Resha'im). 1 '
Seforno: 'Even if I must combine with each city, I will not destroy the worst city of the five. If three or four cities (the majority) are worthy, I will not punish them at all, only the other cities. If only one or two cities are worthy, I will not destroy them, but I will bring upon them suffering. 2
Why did Avraham ask for 40, 30, 20 and 10?
Rashi: If there are ten Tzadikim in each of four cities, those cities should be spared, and similarly for three, two and one.
Moshav Zekenim: All his requests were to save all five cities.
Targum Yonasan: Refer to 18:28:1:3.