Bil'am told the elders of Midyan and of Mo'av that 'Hashem' would appear to him. Why did 'Elokim appear to him?
Oznayim la'Torah: Bil'am did indeed think - and boast - that Hashem would appear to him, but it was not to be. It was only 'Elokim' who appeared to him, on a lower level of prophecy; and it was only later in the Parshah, when he blessed Yisrael, that Hakadosh-Baruch-Hu appreaded to him by the Name of 'Hashem'..
Why did Hashem ask Bil'am the identity of his visitors?
Rashi #1: To trick Bil'am into believing that Hashem does not know everything.
Rashi #2 (in Bereishis, 3:9): It was a polite way of entering into a conversation with him. 1
Seforno: He asked him for the purpose of their visit; 2 whether they came to request a prophecy 3 or in order to curse 4
Refer to Bereishis 3:9:1:1. See Sifsei Chachamim.
Seforno: Which prompted him to prepare himself for prophesy.
Seforno: Which he was now asking from Hashem.
Seforno: And he was asking for permission to carry it out.
Did Bil'am really think that Hashem does not know everything?
Rashi: Yes! Bil'am thought that he will be able to curse Yisrael when Hashem was 'unaware' (Kevayachol).
Rashi (in Koheles, 10:12): He is one of three people whom Hakadosh-Baruch-Hu tested and found them to be 'a dirty bedpan'; he should have answered 'Hashem Elokim, You know who they are!' 1 - but he answered conceitedly. 2
Rashi (Ibid.) Like Yechezkel did in Yechezkel, 37:3.
Da'as Zekenim (citing a Midrash): Also Kayin should have said so when Hashem asked 'where is Hevel?', and Chizkiyah, when Yeshayah asked 'from where did the people come to you?' It seems that it should rather say that the third is Adam, when Hashem asked where he is. Chizkiyah spoke to a Navi. Nevi'im do not know everything! Tzror ha'Mor cites the Midrash to say that Bil'am and Chizkiyah answered improperly, but Yechezkel answered properly ? 'Hashem, You know [whether or not these bones will live]!'