I wonder how God knew this if He is not omniscient....
Genesis 18:18
Abraham will surely become a great and powerful nation, and all nations on earth will be blessed through him.
Easy question. Because God knew what his plan was going to be concerning Abraham.
If God is so wise as to be competent and resourceful in dealing with us instead of manipulating all that happens? Then this would not diminish His authority to govern because such authority that reigns unchallenged is not as absolute as the authority that accepts a challenge. Such supreme independent power requires tremendous wisdom, patience, love, faithfulness, and resourcefulness to work with a world of independent creatures.
This kind of a relationship is not one of domination or manipulation, but of participation and cooperation wherein we become co-laborers with God. It did not have to be this way. It's so only because God wanted a reciprocal relationship of love and elected to make us an important element in such a relationship. And this is why I am suggesting that God has established personal relationships whereby He can have fellowship with us and not that of manipulative or contractual relations.
Those who lived at the time of the first century (when the New Testament Scriptures were first starting to be spoken) prayed boldly because they believed their prayers could change things... even God’s mind. They understood they were working with God to determine the future because God has open routes into the future and He desires we participate with Him in determining which ones to take. And so it can be said we open a window of opportunity for new possibilities for God to carry out His goal when we turn to Him in prayer.
And since prayer affects both parties and changes the situation making it different than what it was prior to the prayer. Then asking in faith may make it possible for God to do something that He could not have done without our asking. And also there are indeed times when the person making the request makes a difference to God because He is interested in a personal loving relationship with us.