I find it strange that Genesis/Bereshit 18:21 seems to imply that G-d has limited knowledge of what's going on in Sodom and Amorah, so I wondered if the word eda'ah (אֵדָעָה) could be translated as: to be aware, or recognize, or acknowledge. In such a case He's accepting the outcry and reacts to it; i.e. in such a case He knows what to do to set things straight.
I will descend now and see, whether according to her cry, which has come to Me, they have done; [I will wreak] destruction [upon them]; and if not, I will know."
Rav Hirsch translates this as being connected to verse 20.
20 And Hashem said (to Avraham): Even if the outcry over Sodom and Gemorrah is great, and their sin weighs exceedingly heavy,
21 I will still go down and see whether, in accordance with the cry which hath come to Me, they have achieved complete destruction, and if not I will discriminate.
Rav Hirsch explains that this means that Hashem is telling Avraham that any punishment (even though He knows what is going on) requires a specific ירידה, an exact investigation, before declaring what the proper punishment will be. In his commentary on verses 23 - 26 Rav Hirsch explains what the two possible punishments could be and what Avraham thinks about them. In this case the term אֵדָעָה does not mean that Hashem does not know, but that He will demonstrate the knowledge by punishing only the wicked. This is similar to the difference between the generation of the Flood and the generation of the Tower of Bavel.
Two alternatives were announced to Abraham for the threatened fate of Sodom, כלה: complete destruction, or ידיעה: punishment of the guilty but allowing the whole to continue. As Hashem had found him worthy of being given insight into His verdict, he feels and thinks deeply of the execution of the verdict, and tries to get clear concerning a thought which worries him.
Did G-d have to descend to investigate a matter in Genesis 18:20 and 21?
A literal reading of the Bible thinks so:
“G-d said, ‘the cry of Sodom and Gomorrah is great, and their misdeeds are very grievous. I will go down now and see whether they acted as [indicated in] the cry that has come up to me, then I will destroy them, if not I will know.’”
The phrase, "if not I will know" is obscure. The simple reading has G-d wondering if He heard correctly, to clarify this, G-d will descend and investigate what is really happening. The prior phrase states that if He discovers that the people did not act properly, he will “destroy them.” G-d concludes “if not,” meaning that they were righteous, then “I will know” this and not harm them.
Rashi supports the notion of a corporeal deity descending when he portrays G-d anthropomorphically. Scripture states: “G-d came down to see the city and the tower that the people built [the Tower of Babel].”
Regarding both stories, the Midrash Tanchuma asks “Does G-d need to descend and see?” it asks. “Isn’t everything known before Him?”
The Midrash explains these stories to be a figure of speech. It informs judges not to make a decision only after a brief insufficient investigation. G-d is all-knowing and all-powerful and does not need to descend to hear or prove anything. Additionally, Onkelos substitutes the anthropomorphic “I will go down” to “I will reveal Myself.” There is nothing that G-d does not already know, He is certainly not taking a trip to learn about circumstances in which He has no prior knowledge. Rather, He is “revealing,” informing them that He is reacting to the evil done. In his commentary to Exodus 19:20, 33:21 and 34:5, Abraham ibn Ezra paraphrases Onkelos and Midrash. In his Guide of the Perplexed 1:10, Maimonides explains the terms “go down” and “go up” is metaphorical, meaning that "going up" indicates that divine revelation is taking place and "go down" means the communication has ended.
Maimonides adds in Guide of the Perplexed 2:45 that all biblical prophecies, with the exception of Moses, were dreams. He writes on 1:10 that G-d's descent is a figure of speech, indicating that the divine decree to render punishment has been acted. Thus, Maimonides says that chapter 18, like the Akedah story, never took place. It was a dream. Abraham dreamed about a conversation with G-d, who descended in anthropomorphic terms. Maimonides will generally rehash a biblical story as a prophecy. This greatly angered Nachmanides, who insisted that the stories in the Bible were true events. It could be argued that the Rambam's interpretations greatly diminished the historical significance of the Bible.