"And I will go; perhaps the LORD will chance to meet me" (Numbers 23:3) — that is, perhaps He will show me favor. "And he went shefi" (Numbers 23:3). From here our Sages, of blessed memory, said: Balaam was lame in one foot, and Samson in both his legs, concerning whom shefi is said; and concerning Samson it is written "shefifon" (Genesis 49:17, "Dan shall be a serpent by the way, a horned viper by the path"). Another interpretation: "shefi" — he went alone. Another interpretation: "shefi" teaches that he scrutinized for the hour in which the Holy One, blessed be He, is angry.
Balaam Goes Shefi - The Lame Diviner Who Hunted God's Hour of Anger
Midrash Aggadah, Numbers 23:3
ואלכה אולי יקרה ה' לקראתי. שמא ישא לי פנים: וילך שפי. מכאן אמרו חכמינו ז"ל בלעם חיבר ברגלו אחת היה ושמשון בשתי רגליו שבה נאמר שפי, ובשמשון כתיב ש]י]ון (בראשית מט יז): ד"א שפי יחיד הלך: ד"א שפי מלמד שפשפש השעה שהקב"ה כועס בה: