Over the years, I have been in many schoolroom classes under many great teachers. The information that they have given me has been very valuable. But I must admit, that often during the periods that I was in class, I had my mind on other things and I missed some of what the teacher was giving me. When that happened, my grades would suffer and I would not benefit from the knowledge that I missed.
One thing I have learned from my many years of life is that God is our greatest teacher. His lesson plan includes the experiences of life that confront us. There is no better teacher in all the world than our God. Yet we don't always concentrate on what He is teaching us. As a result, we often sustain hardships because we don't listen to Him as we should.
In the passage above, Balaam was a man who supposedly had the power to put curses on people. Balak, King of Moab, tried to get Balaam to put a curse on Israel. Balaam, had enough sense to ask God for permission to curse Israel. God did not give Balaam permission. Balak was persistent and offered Balaam riches if he would do so. Balaam went back to God and told Him of the offer. God told Balaam that he could go and speak to Balak, but not put a curse on Israel.
God knew that Balaam's heart was not right and that he still wanted to disobey and put a curse on Israel for the money which was offered. Accordingly, God (as a Theophany) stood in the way of Balaam as he rode a donkey. The donkey recognized God but Balaam did not. Balaam beat the donkey for refusing to keep going.
Consider if you will, that the Donkey is akin to the experiences in life that we face. God is always speaking to us through our experiences in life and we fail to recognize it. In addition, we often curse our experiences rather than learn from them. Finally, we should thank God for those experiences that He sends our way, and we should obey His instructions as we deal with every situation.