One technique of writing is having characters tell each other things they would already know, such as a wife telling her husband, “Our daughter is in school today until 2pm.” Most husbands would already know that, but the audience would not. At least in screenwriting, dialogue is the only way to convey that information to the audience.
The Bible uses similar techniques such as in Genesis 2:18 when God says, “It is not good for man to be alone; I will make a helper fit for him.” Some have asked, “Why would God say this? Did he not know before he created mankind he would create a companion for Adam? After all, he created male and female of all other species.”
Another example is in Job when God asks Satan (or Adversary) twice (1:6 and 2:2) where he has been. Would God not have known what Satan was up to? He is God after all, all knowing and all seeing.
We have to remember, the Bible was written for man, to show him not only who he is, but who God is. God is privy to knowledge we don’t have until we’re told.
What better means to share that knowledge than through story?
The examples above (and others throughout scripture) aren’t to show God’s ignorance, but to convey to us specific information.
In the case of Genesis, it’s to let man know that he needs companionship, a helper, and a partner. That to live alone is not God’s desire for anyone, because it is not good. Anyone who’s endured a solitary life—with rare exceptions—knows it only leads to loneliness and despair.
In the case of Job, it’s to show the reader who Satan is and what he does: that he roams the earth in the midst of man, and we are to be ever aware of his desire to destroy our faith in God, just as he attempted to destroy Job’s.