Almost all of Ha'azinu is a song, written in the Torah in two parallel columns. Moshe summons the heavens and the earth to stand as eternal witnesses to what will happen if the Jewish People sin and do not obey the Torah. He reminds the people to examine the history of the world, and note how the Jewish People are rescued from obliteration in each generation - that G-d "pulls the strings" of world events so that Bnei Yisrael can fulfill their destiny as His messengers in the world. G-d's kindness is such that Israel should be eternally grateful, not just for sustaining them in the wilderness, but for bringing them to a land of amazing abundance, and for defeating their enemies. But, this physical bounty leads the people to become self-satisfied and over-indulged. Physical pleasures corrupt the morals of the people. They worship empty idols and powerless gods, and indulge in all kinds of depravity. G-d will then let nations with no moral worth subjugate Israel and scatter them across the world. However, their only purpose is as a rod to chastise the Jewish People. When these nations think that it is through their own power that they have dominated Israel, G-d will remind them that they are no more that a tool to do His will. The purpose of the Jewish People is fundamental - that man should know his Creator. Neither exile nor suffering can sever the bond between G-d and His people, and, eventually, in the final redemption, this closeness will be restored. G-d will then turn His anger against the enemies of Israel, as though they were His enemies, showing no mercy to the tormentors of His people. G-d then gives His last commandment to Moshe: That he should ascend Mount Nevo and be gathered there to his people.
A Silver Lining
“...with a vile nation I shall anger them.” (32:21)
Rashi comments: These are the unbelievers (the vile nation). And similarly it says, “The vile one says in his heart, ‘There is no G-d’.”
The People of the Torah have suffered much through the millennia at the hands of those who deny G-d. But every cloud, as they say, has a silver lining.
“...I will scatter them; I will cause their memory to cease from man” (32:26)
Because of our sins, G-d wanted to decree complete destruction on the Jewish People. What held His Hand, so to speak, was that the unbelievers would not see this as Divine retribution but rather as result of their own strength and power.
Thus it was really a great kindness that G-d delivered us into the hands of unbelievers, for it was this that prevented the destruction of Yisrael.
Sources: Rabbi Simcha Zissel Zaleznik in Iturei Torah