Firstly God told balaam
Num 22:12 And God said unto Balaam, Thou shalt not go with them; thou shalt not curse the people: for they [are] blessed.
Then they offered balaam his lusts and so then
Num 22:19 Now therefore, I pray you, tarry ye also here this night, that I may know what the LORD will say unto me more.
Num 22:20 And God came unto Balaam at night, and said unto him, If the men come to call thee, rise up, [and] go with them; but yet the word which I shall say unto thee, that shalt thou do.
God already told him do not go. but now the pot was sweeter and he reallly wanted to go, so he asked God again and was told to go. then
Num 22:21 And Balaam rose up in the morning, and saddled his ass, and went with the princes of Moab.
Num 22:22 ¶ And God's anger was kindled because he went: and the angel of the LORD stood in the way for an adversary against him. Now he was riding upon his ass, and his two servants [were] with him.
Now we have to be honest here, we have to stop taking the control and sovereignty away from God. Do we really believe that if it was Gods will to make sure balaam was killed to stop all that would follow this event that God could be stopped from accomplishing it? Do we really think that there are only certain squares of land on earth upon which the angel of the Lord can stand and if you stop short of his space you are spared and he can't step forward and kill you? Of course not. The angel of the Lord once killed 185,000 in ONE NIGHT by himself. Surely if God absolutly wanted balaam dead - he would have been dead.- Gods anger was kindled against Him Clearly what happened is exactly what God desired to happen and even the things that happened are very telling in the rest of the bible but that is a much larger topic like.
Num 22:24 But the angel of the LORD stood in a path of the vineyards, a wall [being] on this side, and a wall on that side.
Num 22:25 And when the ass saw the angel of the LORD, she thrust herself unto the wall, and crushed Balaam's foot against the wall: and he smote her again.
Num 22:26 And the angel of the LORD went further, and stood in a narrow place, where [was] no way to turn either to the right hand or to the left.
Then GOD opened the donkeys mouth to speak to balaam. God could have done anything that He desired, just killed him right there so clearly it was not GODs will or purpose to have had balaam killed.
God told the Israelites that His purpose for them being in the wilderness was to PROVE THEM.
Deu 8:2 And thou shalt remember all the way which the LORD thy God led thee these forty years in the wilderness, to humble thee, [and] to prove thee, to know what [was] in thine heart, whether thou wouldest keep his commandments, or no.
Deu 8:3 And he humbled thee, and suffered thee to hunger, and fed thee with manna, which thou knewest not, neither did thy fathers know; that he might make thee know that man doth not live by bread only, but by every [word] that proceedeth out of the mouth of the LORD doth man live.
If God killed everyone who would bring in the temptations that would prove them, they would never be proved or tried. It may be OUR will and desire to have all things hard removed from us and we may think it would be better if these people didnt exist or were killed before their damage was done, but they serve a purpose to God, even their wickedness is used for the good of those who love him. Even their wickedness is used to bring about the plans of God.
Dan 4:34 ¶ And at the end of the days I Nebuchadnezzar lifted up mine eyes unto heaven, and mine understanding returned unto me, and I blessed the most High, and I praised and honoured him that liveth for ever, whose dominion [is] an everlasting dominion, and his kingdom [is] from generation to generation:
Dan 4:35 And all the inhabitants of the earth [are] reputed as nothing: and he doeth according to his will in the army of heaven, and [among] the inhabitants of the earth: and none can stay his hand, or say unto him, What doest thou?
Indeed none can stay his hand.
Lam 3:37 Who [is] he [that] saith, and it cometh to pass, [when] the Lord commandeth [it] not?
Lam 3:38 Out of the mouth of the most High proceedeth not evil and good?
Lam 3:39 Wherefore doth a living man complain, a man for the punishment of his sins?
Lam 3:40 Let us search and try our ways, and turn again to the LORD.