"And Balak took Balaam to the top of Peor" (Numbers 23:28). Balak was a great diviner, for he saw that Israel were destined to worship Peor, and that the Holy One, blessed be He, was destined to be angry with them; therefore he led him to Peor. And therefore he said, "Perhaps it will be right in the eyes of God" (Numbers 23:27), so that He would grant you permission to curse them, and curse him for me from there.
Why Balak Led Balaam to the Peak of Peor to Curse Israel
Midrash Aggadah, Numbers 23:28
ויקח בלק את בלעם ראש הפעור. קוסם גדול היה בלק לפי שראה שעתידים ישראל לעבוד לפעור, ועתיד הקב"ה לקצוף עליהם, לכך הוליכו לפעור, ולכך אמר אולי יישר בעיני האלהים כדי שיתן לך רשות לקללם וקבותו לו משום: