What did Hashem mean when he asked Adam "Ayeka?"? Did He not know?!
Rashi: Of course Hashem knew, and He only asked him in order to enter into a conversation with him (so as not to confuse him by attacking him outright), as is Hashem's way 1 .
Seforno: He asked Adam why he was not walking in the Garden as he did up to now. And since he did not hide earlier, why was he hiding now?
Targum Yonasan: He asked Adam what made him think that he could hide from Him. Did he not know that Hashem sees everything, irrespective of whether it is day or night? And He queried him about the Mitzvah that He had commanded him.
רש"י: שלא יהא נבהל להשיב: מה פרוש הדברים?
גור אריה: ה' נכנס עמו בדברים לטובתו- כדי שלא יבהל, וישוב בתשובה.