What is the meaning of "Im Lo Sed'i Lach"?
Rashi: This is the shepherd's answer. If you do not know where to go to graze your flock, you, the most beautiful of women, for [I] the shepherd ceased to conduct them (so you yourself need to conduct them).
Seforno: If you do not know the Halachah.
Why is she called "the most beautiful of women"?
Seforno: She is nicest in the Midah of Chesed and Perishus (separation).
What is the answer "Tze'i Lach b'Ikvei ha'Tzon"?
Rashi: Look at their footsteps, the path in which they walked. We find like this - "v'Ikevosecha Lo Noda'u" (Tehilim 77:20), "v'Hu Yagud Akev" (Bereishis 49:19). Trace his steps, and go in that path!
Seforno: [If you waver about the Halachah,] follow the custom.
Malbim (Melitzah): The supreme Shepherd answers, in order to flee from Chatzer ha'Melech and come to Me, i.e. abandon the Yetzer, and bodily desires and matters, and strive to investigate in order to attain My truth, you need two things. (a) You must know My place - where and how to find Me. (b) You need counsel, lest the troops of ha'Melech Shlomo stop you 1 from this investigation. To know My place, go in the footsteps of the flock. To know Hashem Himself is impossible. You can know the world's Shepherd only via the flock that He tends, i.e. via signs of Chachmah, ability, mercy and Chesed recognized in the flock's steps, and life powers based on how He conducts them with His compassion. From this, you recognize the Shepherd's Chachmah and ability.
Malbim (Mashal): I.e. a way that ha'Melech Shlomo's troops will not recognize you.
What is the meaning of "u'Re'i Es Gediyosayich Al Mishkenos ha'Ro'im"?
Rashi: Among the dwellings of the other shepherds that you are by them.
Seforno: Graze the kids - later they will nurse like you do, i.e. Talmidim who will give rulings. [Teach them] Midrashim of Chachamim of the generation, to know the reasons and contemplate which is proper. Your excuse "she'Shezafasni ha'Shamesh" (6; you became used to bad deeds) is not proper.
Malbim (Melitzah): My counsel, lest the troops of ha'Melech Shlomo stop you [from this investigation] is to graze your kids. You should shepherd and conduct your life forces (kids). You should conduct life forces in your small world (the body) like Hashem conduct life forces in the big world. Just like He conducts everything with one end, i.e. the ultimate good and perfection, so you should conduct for the sake of happiness and good. Learn your grazing from Hashem's!
Malbim (Mashal): If you graze your kids by the dwellings of the shepherds, the guards will not recognize you. They will think that you are a shepherd!
What do we learn from "Im Lo Sed'i
Torah Temimah citing Shabbos 33b: When there are Tzadikim, they are punished for sins of their generation. When there are no Tzadikim, children learning from their Rebbi are punished - Gediyim (goats, i.e. Talmidim) are a Mashkon (security) for the Ro'im (shepherds, i.e. Rebbeyim 1 ).
Kesuvos 67a: Nakdimon ben Guryon was astoundingly wealthy, yet [at the time of the Churban] his daughter was gathering barley amidst the hooves of horses in Ako. We read Gediyosayich like Geviyosayich. (If you will not observe the Torah, your bodies will need to graze from the feet of animals.)
Rashi according to the metaphor: If you do not know, My congregation, the most beautiful of women, in the nations, where will you graze and be saved from your afflicters, be among them, and your children will not perish? Contemplate the ways of your first fathers, who accepted the Torah and guarded My guarding and Mitzvos, and go in their hearts' ways. In the reward of this, you will graze your kids by the officers of the nations - "Hatzivi Lach Tziyunim
Rashi (Shabbos 33b): Im Lo Sed'i (if you do not know to guard the Mitzvos), Tze'i Lach b'Ikvei ha'Tzon (request mercy in the merit of the Avos), lest children be punished for the generation.
Malbim: I explained (1:1) that the first Shir refers to the first time that Hashem appeared to Shlomo in a dream, in Giv'on, and asked him what he wants. Shlomo requested a heart to judge between good and evil; Hashem was pleased. Consent and thought in a dream is not from intellect or choice. Rather, if he requested this, perforce he was thinking about this for many days while awake, seeking to understand Mishpat. This is why Hashem appeared to him and granted his request! This is why first the Shir says how his Neshamah strived to recognize Hashem and know His ways. I explained in Tehilim (72:1) that philosophers agreed that man cannot attain Mishpat; it is of Hashem. He is the Supreme lawmaker and understanding of the Klal. This is why Shlomo requested Mishpat from Hashem! David said "Mishpatecha l'Melech Ten" (ibid.), for it can come only from Him.