Why did God have to answer Balaam and give him knowledge of prophetic truths when he sought Him by sorcery/incantation
I agree with the previous responses that state: God did not owe Balaam anything, nor was he obliged on account of anything to supply Balaam with a response to his demand, by sorcery/incantation or some other method. God does not come when "summoned." He will respond (as he promises) when any petition him consistent with the means he established. In that case, he has obliged himself by terms he alone has ordained. He wills it thus; there is no other necessity.
For his own purposes (according to the language of the sacred text) the true and living God let Balaam be a mouthpiece for him. What was Balaam's true power and source of that power, prior to his engagement here by Balak, king of Moab? Some interpreters unite Balak's assertion of confidence, "I know that he whom you bless
is blessed, and he whom you curse is cursed," Num.22:6, with Balaam's promise of v8, "I will bring back word to you, as the LORD speaks to me," apparently invoking the name of Israel's God. In this they assume that Balaam was honest-to-goodness a prophet of the Most-High-God. It is quite a slender pillar of support, though it has additional strength from Balaam's claim in v18, "...the LORD my God." Based on all other biblical evidence, it is most evident that Balaam did not have the LORD for his God.
The one true God could have used Balaam before this moment; the text is silent; though I doubt Balaam's familiarity with the LORD. God (Elohim) came v9 to Balaam overnight (presumably in a dream, the manner is not specified) and Balaam received a word from the spirit-realm. Balaam attributed his instruction to the LORD, as he returned the next morning to speak to Balak's emissaries, v13, telling them he was not able to fulfill their request because of the LORD's restriction.
All this seems obscure to us, who are used to a world where monotheism predominates, and where in various ways interference from the spirit-realm has been marginalized (to the common perception). Imagine a bygone era, when men regularly invoked demonic (spiritual) power, side by side with those who called on the name of the LORD.
What Balaam knew in his own time was this: he had built a reputation of accuracy by whatever means, invoking powers beyond the average ability for the purpose of connecting good fortune or ill, as some were willing to pay him for the service. Whether he was able to negotiate that certain results came about or specific acts were undertaken by demonic intrusion; or if he merely latched on to scraps of demonic plans he was able to parlay into safe bets on the future--his power of "prediction" was lucrative.
Balaam also must have been sufficiently informed as to know who Israel was before Balak's men came to see him; and to know which god/spirit was theirs. He need not "know" their god as God, or have prior interaction with him. By night he took his ordinary route into the spirit-realm, possibly seeking some interaction with Israel's god, in order to gauge his own power to make a successful contract with Balak.
The results were successful, in that he did encounter God in some way; yet unsuccessful, in that in light of his interaction he knew he had no way of issuing a reliable testimony for Barak. The Power he had met was beyond any influence, with plans beyond discovery. Perhaps there were other spirit-witnesses besides, confirming his impressions of the LORD. Balaam knew he could not succeed in fulfilling Balak's contract for a curse on Israel that had any likelihood of issuance; and in fact Israel's LORD was aware of the scheme and would surely act against any encouragement or effort on the ground.
For Balaam, anything that threatened his reputation for accuracy was a thing to be avoided, inasmuch as loss of prestige meant loss of income. He probably had mixed feelings on sending the delegation away, glad to avoid trouble but sorry to lose a contract. How must it have stirred his greedy heart to consternation to have an even more impressive delegation return, desperately offering even more.
In between those visits, I can imagine Balaam investigating the Power that had spoken to him, learning more about him and his greatness, and possibly thinking to himself: "I should attach myself to this Spirit and gain his trust, thereby increasing my reputation." No wonder, if on the next visit from Balak's men, he began referring to the LORD as "my" God. It was nothing more than an assertion of access, a feint (for the benefit of the hearers) at familiarity.
In this, we can see how Balaam actually failed to apprehend the truth concerning the LORD God of Israel. Balaam thought of himself as an adept, skilled in penetrating the spirit-realm and engaging with the beings and powers he met there for his advantage. Similar to Laban (the uncle of Jacob)--who thought that by controlling Jacob he would divert Jacob's material blessings, the product of his fairy-god, into his own coffers--Balaam's more sophisticated but still trivial concept of Israel's god worked at last to his disadvantage. The LORD God is not like the other gods.
When Balaam set off (with the LORD's spoken permission) the next day, Num.22:21, he may have been smug in that "influence" which he thought he had gained. Perhaps he believed he would use such words that the LORD would be placated, AND that Balak would reward. For my part, I doubt Balaam understood that he would have NO control whatsoever of that which came out of his mouth.
It is in this light that I think God's "anger" v22 is explicable. Balaam left with the envoys, thinking he had accurately understood the clever path he should take to gain a huge ransom, winking at the LORD with whom he had an "understanding," when in fact he understood nothing and had no relationship with the LORD. This is the import of the words the Angel spoke, v32, "Behold, I have come out to stand against you, because
your way is perverse before Me." At that moment, he was ready to turn tail and run home; but the LORD wouldn't let him; and made Balaam understand he would prophesy
exactly the words that were put in his mouth, v35. v38, "And Balaam said to Balak, “Look, I have come to you! Now, have I any power at all to say anything? The word that God puts in my mouth, that I must speak.”
Events were definitely not working out as Balaam had expected, intended, or "negotiated." He prophesied as one must, if the LORD has put the words in his mouth; thereby angering Balak without remedy. What we find out only later, in Num.31:16, is that Balaam gave evil counsel to Barak afterward, using what knowledge he had of Israel's holy and upright LORD to advise the heathen king on creating a "plague" for Israel, a breach between people and their God. Peter later described Balaam as one "who loved the wages of unrighteousness," 2Pet.2:15. Christ declares, by the pen of John, "Balaam... taught Balak to put a stumbling block before the children of Israel," Rev.2:14. The sin of Peor was remembered in Psalm 106:28 and prophetic oracle, Hos.9:10.
Balaam was a degenerate prophet, more of a soothsayer and magician than one who really stood in the counsels of the Almighty to learn and then declare his will to men. If God used him (and he did) to bless Israel, and if God allowed him then to prove his nefarious and resentful heart by trying to pry apart Israel from its LORD and bringing up the good indignation of God (but for a corrupt goal)--God was perfectly just to both use the man, and bring him to ruin afterward, Num.31:8.