that's a great question! why does omniscient God marvel at anything? can God be surprised??
Yes.
Let's put an end to the flawed concept that because God doesn't change that this must somehow mean God never changes his mind. This is false:
Consider King Hezekiah. God told him to get his house in order because he was about to die. Hezekiah begged the Lord to let him live, so He gave him 15 more years. God did not change, but God changed his mind! Two very different things!
Exo 32:14 And the LORD repented of the evil which he thought to do unto his people.
Ex 32:14 So
the Lord changed His mind about the harm which He said He would do to His people.
NASB
Amos 7:1 Thus the Lord GOD showed me, and behold, He was forming a locust-swarm when the spring crop began to sprout. And behold, the spring crop was after the king's mowing.
2 And it came about, when it had finished eating the vegetation of the land, that I said, "Lord GOD, please pardon! How can Jacob stand, For he is small?"
3
The LORD changed His mind about this. "It shall not be," said the LORD.
4 ¶Thus the Lord GOD showed me, and behold, the Lord GOD was calling to contend with them by fire, and it consumed the great deep and began to consume the farm land.
5 Then I said, "Lord GOD, please stop! How can Jacob stand, for he is small?"
6
The LORD changed His mind about this. "This too shall not be," said the Lord GOD.
7 ¶Thus He showed me, and behold, the Lord was standing by a vertical wall, with a plumb line in His hand.
8 And the LORD said to me, "What do you see, Amos?" And I said, "A plumb line." Then the Lord said, "Behold I am about to put a plumb line In the midst of My people Israel. I will spare them no longer.
Another time God changed his mind was regarding the Israelites and the golden calf. God initially was going to destroy them and make a new nation of people from the descendants of Moses instead but Moses intervened and God changed His mind again and allowed the people of Israel to live.
Genesis 6:6 And it repented the LORD that he had made man on the earth, and it grieved him at his heart.
Here God feels like he should not have created mankind. He regrets the decision and is very upset over it. If God didn't change his mind he would not have to regret any decisions. It also shows that he didn't know that man would have become so wicked otherwise he wouldn't have made man.
Isa 5:2 And he fenced it, and gathered out the stones thereof, and planted it with the choicest vine, and built a tower in the midst of it, and also made a winepress therein: and he looked that it should bring forth grapes, and it brought forth wild grapes.
"He dug it all around, removed its stones, and planted it with the choicest vine. And He built a tower in the middle of it and also hewed out a wine vat in it; Then
He expected it to produce good grapes, but it produced only worthless ones" (Isa. 5:2).
Here God clearly expected one thing but another thing occurred proving in this particular situation showing he did not know what would occur.
God can choose to know the future or choose not to as in the above example.
Isaiah 43:25 I, even I, am he that blotteth out thy transgressions for mine own sake, and will not remember thy sins.
How does an all knowing God not remember sins? Wouldn't that be a contradiction?
For example, his knowledge of the future is "iffy" in the case of Sodom. "If I find... " Also, Jer. 18 states that God warns, then waits to see what happens, before taking action. Now, if God know the future ahead of time, he would not have to wait around to see what is going to happen.