At face value, Bilam appears to follow precisely the word of Hashem. When he is instructed not to curse the Jewish people he complies. It is only after Hashem grants him permission to accompany the servants of Balak does he embark on his mission. Despite the granting of permission, Hashem is immediately angry with Bilam for going. If Bilam is following the directions he received, why is Hashem angry? Why should someone who listens to Hashem be recorded in history as Bilam harasha?
Rav Elchanan Wasserman in his Kuntres Divrei Sofrim develops an approach to understand the source of the cheit of Bilam. The fundamental obligation of each human being is to do the will of Hashem. This will is revealed to us in two different ways. Sometimes Hashem tells us explicitly what He expects of us. Other times He lets us try to determine on our own what He wants of us. The demands of the explicit revelation are straightforward. Whatever is told to us though a navi is the expressed will of Hashem. The second class of imperatives, however, is not as clear. We must determine based upon our understanding of the explicit commands of Hashem what He wants us to do when He doesn't expressly reveal His will. Obviously one who has a better understanding of the explicit will of Hashem will be able to apply that knowledge towards a clearer understanding of how to act in the absence of a stated message.
Bilam as a prophet had previously been given the word of Hashem explicitly. He knew about Hashem, as his self-description testifies, "yodea da'as elyon - one who knows the wisdom of the Almighty." He undoubtedly knew of the special relationship Hashem has with His people. The entire world was aware of the events of yetzias Mitzrayim. How much more so did a prophet of Hashem understand that He showered the Jewish people with His love. He knew that Hashem did not approve of his going with the servants of Balak. When Hashem "granted him permission" it clearly was not a change in His will. Bilam was merely being told that he will no longer receive an explicit command to not go. The obligation of following the unspoken will of Hashem required of Bilam to refuse to continue. Yet, Bilam justified his actions to proceed because he wasn't told explicitly to the contrary. Bilam is the model of listening to the explicit word of Hashem while simultaneously missing the complete message. As one who should have personified "yodea da'as elyon" he incurred the wrath of Hashem for ignoring His unspoken wishes.
Bilam the prophet had no excuse for not reaching the proper conclusion regarding what Hashem truly wanted. But how do we, who are not neviim, determine what the message of Hashem is when that message is not explicit? The secret can be found in the words that describe Bilam - "yodea da'as elyon". Hashem has given each of us access to the highest prophecy ever attained - the Torah, which is the prophecy of Moshe Rabbeinu, the adon hanevi'im. The greater one's understanding of the Torah, the more he becomes a "yodea da'as elyon". One can only know how to read in between the lines if he knows intimately what appears on the lines.
Dinim d'rabbanan (laws of rabbinic origin) are the "in between the lines" of the Torah laws. Hashem gave us six hundred and thirteen biblical commandments. He also instructed us to safeguard these mitzvos and to follow the spirit of the law and even to sometimes institute mitzvos d'rabbanan when the occasion arises. This area of Halacha is much more difficult than the six hundred and thirteen mitzvos. After all, if Hashem doesn't tell us explicitly how to enact the proper safeguard around His mitzvos, how do we know we are fulfilling His will with the safeguards that we put into place? Who are we to say what the spirit of any given mitzvah is all about? How can we be certain that we are responding appropriately to events such as those leading up to the celebration pf Purim and Chanukah?
It is only those who have reached the thorough understanding of the explicit word of Hashem who can apprehend what His unspoken will is. Chazal and the chachamei haTorah in each generation are given the responsibility as the "yodei da'as elyon" to search and understand what is on the lines themselves to determine properly what is in between the lines. In contrast to Bilam who refused to submit himself to the unspoken will of Hashem, we are committed to fulfill the ratzon Hashem in its entirety, and look to the "yodei da'as elyon" with whom Hashem has blessed us to guide us in fulfilling His will.