This was a great question. Some may think that God engages with humans in this manner, asking such questions, to give them a chance to admit whatever they have done. But that is not correct-- it is actually quite the opposite. He often (not all the time) does these things to demonstrate the weakness of mankind, whether it is wickedness, lack of faith, and etcetera-- basically why we need Him and what we would do without Him. Let's go through this one by one starting with Adam and Eve, then ending with Jesus.
Part 1
Adam and Eve
"And he said, Who told thee that thou wast naked? Hast thou eaten of the tree, whereof I commanded thee that thou shouldest not eat (Genesis 1:11)?"
God made Himself scarce to prove a point: With Him out of the picture, mankind would sin on their own (Satan cannot be blamed here since Eve was not possessed as Judas was).
Tower of Babel
"And God blessed Noah and his sons, and said unto them, Be fruitful, and multiply, and replenish the earth (Genesis 9:1)."
"And they said, Go to, let us build us a city and a tower, whose top may reach unto heaven; and let us make us a name, lest we be scattered abroad upon the face of the whole earth. And the LORD came down to see the city and the tower, which the children of men builded. And the LORD said, Behold, the people is one, and they have all one language; and this they begin to do: and now nothing will be restrained from them, which they have imagined to do. Go to, let us go down, and there confound their language, that they may not understand one another's speech. So the LORD scattered them abroad from thence upon the face of all the earth: and they left off to build the city (Genesis 11:4-8)."
Once again, mankind did not follow God's command. Notice
how God speaks of mankind in the same manner as with Adam and Eve:
"And the LORD God said, Behold, the man is become as one of us, to know good and evil: and now, lest he put forth his hand, and take also of the tree of life, and eat, and live for ever: Therefore the LORD God sent him forth from the garden of Eden, to till the ground from whence he was taken. So he drove out the man; and he placed at the east of the garden of Eden Cherubims, and a flaming sword which turned every way, to keep the way of the tree of life (Genesis 3:22-24)."
For these two situations: God gives a command, mankind goes against it, God makes a comment, and then He punishes them-- He is making a point. Pharaoh and the Egyptians are next (I'll mention Sodom later).
The Exodus from Egypt
"And it came to pass, that in the morning watch the LORD looked unto the host of the Egyptians through the pillar of fire and of the cloud, and troubled the host of the Egyptians, And took off their chariot wheels, that they drave them heavily: so that the Egyptians said, Let us flee from the face of Israel; for the LORD fighteth for them against the Egyptians (Exodus 14:24-25)."
This may not obvious at first, but it is the Angel of the Lord who is being referred to as the Lord here. Why? Because 13:21 says that it was the Lord in the pillar leading the Israelites, while 14:19 says that it was the Angel and that the same pillar moved in the same fashion as that Angel. Thus, we can say that it was the Angel that looked at the Egyptians from within the pillar. See Exodus 3:2; 19:18; 20:21; 33:9,11; 34:5 and Numbers 12:5,8-10 and Judges 6:21; 13:20 for supporting evidence of the Angel being in the pillar. So, this counts as God going down to observe people misbehaving (the Egyptians). But again, He knew what was going to happen:
"And I am sure that the king of Egypt will not let you go, no, not by a mighty hand (Exodus 3:19)."
"And I will harden Pharaoh's heart, that he shall follow after them; and I will be honoured upon Pharaoh, and upon all his host; that the Egyptians may know that I am the LORD. And they did so (Exodus 14:4)."
"O thou king, the most high God gave Nebuchadnezzar thy father a kingdom, and majesty, and glory, and honour: And for the majesty that he gave him, all people, nations, and languages, trembled and feared before him: whom he would he slew; and whom he would he kept alive; and whom he would he set up; and whom he would he put down. But when his heart was lifted up, and his mind hardened in pride, he was deposed from his kingly throne, and they took his glory from him: And he was driven from the sons of men; and his heart was made like the beasts, and his dwelling was with the wild asses: they fed him with grass like oxen, and his body was wet with the dew of heaven; till he knew that the most high God ruled in the kingdom of men, and that he appointeth over it whomsoever he will. And thou his son, O Belshazzar, hast not humbled thine heart, though thou knewest all this; But hast lifted up thyself against the Lord of heaven; and they have brought the vessels of his house before thee, and thou, and thy lords, thy wives, and thy concubines, have drunk wine in them; and thou hast praised the gods of silver, and gold, of brass, iron, wood, and stone, which see not, nor hear, nor know: and the God in whose hand thy breath is, and whose are all thy ways, hast thou not glorified:(Daniel 5:18-23)."
So what does all this mean? It means that God orchestrated all of this. Him saying that He was "sure" was an understatement that is no different than Him asking where Adam was or if Sodom needed to be destroyed. He does this to magnify Himself and show His glory. Belshazzar's actions are no different than Pharaoh's. See Psalms 37:23 and Proverbs 16:9; 20:24 and Jeremiah 10:23 for supporting evidence.
Elijah at Horeb
Next, we have Elijah at Mount Horeb. This example ties to judgement as the previous ones, but less directly. Instead, it highlights the lack of faith that humans have in God, but also that God has everything in His control.
"And he came thither unto a cave, and lodged there; and, behold, the word of the LORD came to him, and he said unto him, What doest thou here, Elijah? And he said, I have been very jealous for the LORD God of hosts: for the children of Israel have forsaken thy covenant, thrown down thine altars, and slain thy prophets with the sword; and I, even I only, am left; and they seek my life, to take it away(1 Kings 19:9-10)."
Elijah was afraid of the situation that he was in; he even wanted to die. God's question was illustrating that he had a mission to accomplish and could not let anything get in the way of that. It also showed that nothing could have stopped Elijah from completing that task because God had set it up that way. His question could be rephrased as "what did I bring you here to do?" or "Are you not still alive?". God's hand is not waxed short; what He wants to happen will happen.
Jonah
Jonah's situation resembles that of Elijah's. No, nobody was seeking his life, but he, too, was upset and wanted to die. When people feel that they have failed, they often resort to death. See Numbers 11:15 and Job 6:9; 7:16 and Matthew 27:5 and Acts 1:18; 16:27.
"Therefore now, O LORD, take, I beseech thee, my life from me; for it is better for me to die than to live. Then said the LORD, Doest thou well to be angry (Jonah 4:3-4)?"
"But he himself went a day's journey into the wilderness, and came and sat down under a juniper tree: and he requested for himself that he might die; and said, It is enough; now, O LORD, take away my life; for I am not better than my fathers (1 Kings 19:4)."
They both faced unfavorable weather conditions, too.
"And it came to pass, when the sun did arise, that God prepared a vehement east wind; and the sun beat upon the head of Jonah, that he fainted, and wished in himself to die, and said, It is better for me to die than to live. And God said to Jonah, Doest thou well to be angry for the gourd? And he said, I do well to be angry, even unto death (Jonah 4:8-9)."
"And he said, Go forth, and stand upon the mount before the LORD. And, behold, the LORD passed by, and a great and strong wind rent the mountains, and brake in pieces the rocks before the LORD; but the LORD was not in the wind: and after the wind an earthquake; but the LORD was not in the earthquake: And after the earthquake a fire; but the LORD was not in the fire: and after the fire a still small voice (1 Kings 19:11-12)."
So what does the wind, earthquake, fire, and the sun represent in these two passages? Trouble-- hardships of life and from the people around us. See Daniel 12:1 and Matthew 24:21 and Revelation 7:14.
But God demonstrated that He is able to save from that. For Jonah, He provided the gourd. For Elijah, He sent him to the cave. God is the provider and hiding place. See Exodus 33:22 and Psalm 5:12; 9:9; 27:5; 31:20; 32:7 and Isaiah 4:6.
Disciples
God asked His twelve disciples "rhetorical" questions as well. As you can see, their situations (or the explanations given by Jesus) were not so different than Elijah's or Jonah's.
"Wherefore, if God so clothe the grass of the field, which to day is, and to morrow is cast into the oven, shall he not much more clothe you, O ye of little faith (Matthew 6:30)?"
Clothing resembles protection-- a covering. This is like Elijah being in the cave and being able to cover his face with his mantle, and Jonah having shade from the plant. The worm that ate the gourd is like the ravens (not quoted) that God feeds. The oven is analogous to the sun that beat on Jonah's head.
"And he saith unto them, Why are ye fearful, O ye of little faith? Then he arose, and rebuked the winds and the sea; and there was a great calm (Matthew 8:26)."
The winds and the sea are synonymous with the vehement east wind, the tempest on the way to Tarshish (not quoted), and the wind that tore the mountain.
"And immediately Jesus stretched forth his hand, and caught him, and said unto him, O thou of little faith, wherefore didst thou doubt (Matthew 14:31)?"
Peter was afraid of the boisterous wind, which is the cares of this life. See Job 31:26 and Matthew 16:3 and Luke 12:56; 21:34. Rumors (not quoted) and vain tangible things can be distracting.
"Which when Jesus perceived, he said unto them, O ye of little faith, why reason ye among yourselves, because ye have brought no bread(Matthew 6:30)?"
This goes back to the ravens and the grass-- some how God takes care of them.
"Thinkest thou that I cannot now pray to my Father, and he shall presently give me more than twelve legions of angels? But how then shall the scriptures be fulfilled, that thus it must be (Matthew 26:53-54)?"
God is asking them (but directly Peter) if they do not believe in God's strength, but is stating that this all has to happen so that the scriptures are fulfilled. An example of this is Sodom and Egypt, where our Lord was crucified. God intended to destroy both of those places because they were foreshadowing what was to happen with not only the major religious sects of Israel in Jesus' time, but also at the end of the world.
"Art thou the Christ? tell us. And he said unto them, If I tell you, ye will not believe: And if I also ask you, ye will not answer me, nor let me go (Luke 22:67-68)."
The Pharisees declined to answer many of Jesus' questions prior to this such as the ones regarding Christ being David's son and the John's baptism. They chose to do that-- it is not as if they did not know the answers. The answers were simply not agreeable with them.
"And I say unto thee, Let my son go, that he may serve me: and if thou refuse to let him go, behold, I will slay thy son, even thy firstborn (Exodus 4:23)."
It is not so much that they did not have it within themselves to let Him go (but that is true), but rather, Jesus was showing that God would not allow them to do that. After all, the scriptures had to be fulfilled. Did the scriptures entail the Jews having mercy on Him? No, He had to die.
Jesus
Jesus is the final person to be studied for this topic (at least for now). He, too, had some concerns that He expressed.
"I am come to send fire on the earth; and what will I, if it be already kindled? But I have a baptism to be baptized with; and how am I straitened till it be accomplished! Suppose ye that I am come to give peace on earth? I tell you, Nay; but rather division: (Luke 12:49-51)."
The fire He is referring to is the same as the one Elijah witnessed and also the heat that Jonah endured. The division and lack of peace are the winds and waves that Elijah, Jonah, and the disciples experienced. Here, Jesus is stating His mission and how distressed He is, just like Elijah (but more so).
"Now is my soul troubled; and what shall I say? Father, save me from this hour: but for this cause came I unto this hour (John 12:27)."
He is saying that there is nothing that can be done. The burden is on Him and He must continue without complaint, as exemplified when He often withdrew from people to be alone and would not answer His accusers. See Lamentations 3:28 and Isaiah 53:7.
"And he went a little further, and fell on his face, and prayed, saying, O my Father, if it be possible, let this cup pass from me: nevertheless not as I will, but as thou wilt. And he cometh unto the disciples, and findeth them asleep, and saith unto Peter, What, could ye not watch with me one hour (Matthew 26:39-40)?"
Yet again, He is demonstrating that everything is set, nothing can be done. And, the disciples are very sorrowful because they are only mindful of the things of men, and cannot understand that Christ ought to enter into His glory by these means.
Summary of Part 1
God asks questions to demonstrate-- not to give people a chance to repent or admit to what they have done. He demonstrates the issues that humans face and also how He is in total control.