Devarim / Deuteronomy 31:21 · Pshat
וְהָיָה כִּי־תִמְצֶאןָ אֹתוֹ רָעוֹת רַבּוֹת וְצָרוֹת וְעָנְתָה הַשִּׁירָה הַזֹּאת לְפָנָיו לְעֵד כִּי לֹא תִשָּׁכַח מִפִּי זַרְעוֹ כִּי יָדַעְתִּי אֶת־יִצְרוֹ אֲשֶׁר הוּא עֹשֶׂה הַיּוֹם בְּטֶרֶם אֲבִיאֶנּוּ אֶל־הָאָרֶץ אֲשֶׁר נִשְׁבָּעְתִּי׃
And when many evils and troubles befall it, this song shall testify before it as a witness, for it will not be forgotten from the mouths of its offspring. For I know its inclination, how it acts already today, before I have brought it into the land which I swore."
Pshat פְּשָׁט
A song that will not be forgotten
Sometimes parents write their children a letter in advance: "when things are hard, read this". The Eternal gives the people a song that will speak when troubles come. The commentators explain what kind of witness it is and why it will not be forgotten.
Rashi: in the song the Eternal warned in advance of all that would happen, and the verse promises that the Torah will never be wholly forgotten by the descendants. Sforno: the people await the land not for service but to sate their desires, and trouble will come from this. Chizkuni: the song will not be forgotten because after the rebukes there is comfort at its end.
How Rashi, Sforno, and Chizkuni explain it
Rashi This song shall testify before it as a witness
For in it I warned him about all that would befall him.
Rashi For it will not be forgotten from the mouths of its offspring
This is a promise to Israel that the Torah will not be wholly forgotten by their offspring.
Sforno For I know its inclination, how it acts already today
They do not await entering the land in order to serve Me in it, as I intended, as it is said: "And He gave them the lands of the nations, that they might keep His statutes" (Tehillim / Psalms 105:44–45). They await it to sate their craving souls, and from this all the evil he prophesied will follow: "But Yeshurun grew fat and kicked" (Devarim / Deuteronomy 32:15).
Chizkuni For it will not be forgotten from the mouths of its offspring
Although there are many rebukes in it, at its end there are consolations.
Takeaway
"This song" is the song Haazinu (Devarim / Deuteronomy 32), which Moshe (Moses) wrote down and taught the people that same day (verse 31:22).
Onkelos renders "song" (הַשִּׁירָה) as "praise" (תֻּשְׁבַּחְתָּא), and "I know" as "it is revealed before Me" (גְּלֵי קֳדָמַי), so as not to speak of the Eternal's knowing as a human's.
Yeshurun is a tender name for Israel in the song Haazinu. Chizkuni means the song's end: "Rejoice, O nations, with His people" (Devarim / Deuteronomy 32:43).