Devarim / Deuteronomy 31:6
חִזְקוּ וְאִמְצוּ אַל־תִּירְאוּ וְאַל־תַּעַרְצוּ מִפְּנֵיהֶם כִּי יְהוָה אֱלֹהֶיךָ הוּא הַהֹלֵךְ עִמָּךְ לֹא יַרְפְּךָ וְלֹא יַעַזְבֶךָּ׃
Be strong and courageous, do not fear and do not be terrified of them, for the Eternal your Almighty, He is the one who goes with you. He will not let go of you and will not forsake you."
Pshat פְּשָׁט
A hand in battle
Rashi: "will not let go of you" means He will not let you weaken until you are left without Him. Sforno: in battle He holds your hand, and after it He does not take His eyes off you or let your neighbours rise against you. Malbim: the Eternal goes both ahead and among the people, so there is no need to fear an attack from behind.
How Rashi, Sforno, and Malbim explain it
Remez רֶמֶז
Three ways of walking
Kli Yakar: the people need support, and the Eternal goes with them, holding their hand. Yehoshua needs less support, and the Eternal goes before him. And Moshe "went" alone, like the sun that shines by itself. Alshekh: Moshe says "be strong" in the plural, because strength is needed when the people are divided. When they are united, the Eternal is "with you", in the singular, and there is nothing to fear.
How Kli Yakar and Torat Moshe explain it
Drash דְּרָשׁ
Who goes in front
Midrash Tanchuma: the Eternal does not leave Israel, He goes out before them and wages the war Himself. So Devorah (Deborah) says to Barak: "has not the Eternal gone out before you?" A king of flesh and blood stands behind his army, but the Holy One, blessed is He, goes in front. Rabbi Berechyah: "I am with him in trouble".
How Midrash Tanchuma explain it
Sod סוֹד
Before, beside, behind
Degel Machaneh Ephraim: the highest level is when the Eternal goes before a person, the middle one beside him, the lowest behind him. The people as a whole received the middle level, and Yehoshua (Joshua), who holds the whole generation within him, the highest. Ba'al Shem Tov: the Eternal goes with you both in descent and in ascent. Even when He is hidden, it is not to push you away.
How Degel Machaneh Ephraim and Ba'al Shem Tov explain it