We see in Vayeira 18:32
32 And he said, "Please, let the Lord's wrath not be kindled, and I
will speak yet this time, perhaps ten will be found there." And He
said, "I will not destroy for the sake of the ten."
perhaps ten will be found there: For fewer [than ten] he did not ask. He said, “In the Generation of the Flood, there were eight: Noah
and his sons, and their wives, but they did not save their
generation.” And for nine, together with counting [God] he had already
asked, but did not find.
Avraham knew that there had to be ten righteous people because Hashem had already showed at the time of the flood that fewer could not save a society. In the time of Noach, Hashem waited until Mesushelach died before bringing the flood. At that time, Hashem was considered part of the count and Noach, his sons, and their wives totaled eight. Mesushelach was the tenth righteous person who kept the flood from occurring. Avraham realized this and therefore had to stop at ten.
The meforshim do ask why he started at fifty? Rashi explains that Avraham wanted to save all five cities. However, when there were not 50 (10 in each city) or 45 (Hashem being the tenth in each city), then he tried to save as many cities as possible.
Rashi on Vayeirah 18:29
Perhaps forty will be found there: And four cities will be saved, and
so thirty will save three of them, or twenty will save two of them, or
ten will save one of them. — [from Zohar, vol. 1, omissions, 255b]
Rav Hirsch Vayeirah 18:26 says that the lower numbers might still be considered to show that the society still accepted some righteousness and that they could therefore be allowed to live in the hopes that the next generation might be affected.
God answered: If there are still, in a state like Sodom,
fifty righteous men who not only publicly live a moral and just life, but
who can even stand up for morality, justice, and humaneness, then not
only למענם, not only for the considerationof, for the sake of, these
righteous ones, but בעבורם through them, because these righteous ones
exist ans are tolerated, the whole city deserves forgiveness.
Their existence and being tolerated would itself be a proof that the
degeneration had not yet reached the lowest depth.
Rav Hirsch deals with the continuation of Avraham asking for fewer people and the change in the wording of the answer in verse 28 as follows:
The gradually increasing demand in Abraham's requests and the change
in terms used in the replies לא אשחית, לאאשחית, לא אעשה, also seems
strange. Perhaps the following suggestions may throw some light. If
our assumption of the nature of the incident is correct, then God's
reply looks on the saving of the town, if fifty righteous men can be
found, from a different point of view from Abraham's supposition. Not
out of consideration for them and their feelings but on the ground of
their existence, of their being there at all. From the former point of
view, of course the cosideration for the righteous would become less
and less the fewer their number happened to be, but that could not be
the case from the latter point of view. If the number of its members
is imposing, it is tolerated out of fear. If it is small enough to be
negligible, it is tolerated only because it is overlooked. Only when
it consists of a medium number, where it is neither feared nor
overlooked, does its existence, its being tolerated, have its full
significance. Above this number and below it, its significance
Perhaps Abraham was seeking clarity concerning this condition and perhaps the change in the expression might correspond to it. לא אשחית,
I will not destroy, will not bring כלה, but will perhaps interpose My
authority otherwise to effect betterment: אדעה: לא אעשה, I will do
nothing at all, there are sufficient moral elements among the masses
so that a betterment from within is still not impossible. Hence, with
forty five, twenty, and ten, לא אשחית, and only with forty and thirty
לא אעשה. Perhaps.
Below ten, not only was the number so negligible as to be ignored, but it was too small for Hashem to be able to use His authority to raise the level of the future generations (as we have seen by Noach).
Rav Hirsch concludes:
Had there been in the purlieus of Sodom and Gomorrah, ten righteous
men to be found, God would not have despaired of a better future for
all, and would have let them all live for this better future. But
where God shows us no reason to despair, we too must courageously
preserve an play our part, and unremmitingly and confident of ultimate
success stand up for what is right even in it means being in
opposition to the whole of our erring contemporaries, and even if this
ultimate victory will only dawn long after we are in our grave.