Why do punishments (the previous verse) and consolation (here) come together in one Dibur?
Rashi, from Pesachim 87b: Hoshe'a realized that he had sinned via asking Hashem to switch Yisrael for another nation. He requested mercy for them.
Rashi citing Sifri d'Vei Rav, Bamidbar 131: There are adjacent Parshiyos that are distant like from the east [of the world] to the west. "Ki Atem Lo Ami?; v'Hayah Mispar Bnei Yisrael k'Chol ha'Yam..." ): how are they connected? A Mashal for this is a king who was angry at his wife. He sent for a scribe to write a Get for her. Before the scribe came, he was appeased with her. He said, should the scribe leave astounded why I called him without need?! He commanded him to write a new Kesuvah for double the amount.
Rashi: You are not My nation, and I will not be to you ? I will act like this. You will be exiled among the nations, and there you will increase and sprout, and put to your hearts to return to Me ? " va'Hashevosa El Levavecha b'Chol ha'Goyim Asher Hidichacha?" (Devarim 30:1). Also here, "v'Nikbetzu Bnei Yehudah u'Vnei Yisrael Yachdav" (2).
Radak: Even though now they were called Lo Ami, a time will come when their number will be like sand which cannot be measured or counted.
Malbim: It was difficult for Hoshe'a to expel his wife and children. Therefore he retracted from his first words and began to advocate for Yisrael. He said to Hashem, how do you want to send the mother (Kenesiyah) and her children? In the future they will be like sand of the sea, which cannot be measured or counted.
What is the comparison to sand?
Malbim: Even though sand has a number ? things do not exist without limit, like it says in Moreh ha'Nevuchim ? no man can count them, due to their great number and fineness. Even though it is possible to measure it, one cannot do so, for most is hidden under the depths of the sea and the land; man cannot reach there. So it will be impossible to count Yisrael, due to their number, and due to being scattered and hidden in the ends of the land, to the point that many of the Shevatim are considered lost, for no one knows their place, like sand buried in depths of the sea.
If they cannot be measured, all the more so they cannot be counted!
Radak: Indeed, the verse mentions something we can learn from a Kal v'Chomer, just like below "Ein Emes v'Ein Chesed" (4:1). Measuring applies to sand; only counting applies to stars. This is why Yirmeyah divided them ? "Asher Lo Yisafer Tzva ha'Shamayim v'Lo Yimad Chol ha'Yam" (33:22). Even though Yirmeyah said this Mashal about two families in Yisrael, Hoshe'a said it about all of Yisrael. This is not difficult 1 ; both of them are exaggerations. They merely show great increase.
I.e. how can the same expression apply to both? Surely all of Yisrael are more! (PF)
What is the meaning of "bi'Mkom Asher Ye'amer Lahem Lo Ami Atem"?
Radak: Nowadays, it is said to them "you are not My nation", due to their evil deeds. In place of this?
Radak citing Targum Yonasan: In the place that they were exiled among the nations, when they transgressed the Torah, and it was said to them "you are not My nation", they will return and multiply, and it will be said to them 'the nation of the living G-d.'
Malbim: In place of being cast off in Galus, and He hid His face from them?
Why will they be called "Bnei Kel Chai"?
Radak: They will repent to Hashem, and He will return their exile and have mercy on them. Nowadays, they make themselves children to other gods that are not alive. And even those that are alive, i.e. the Mazalos 1 , they live only due to the first Cause that gives life to them. Hashem lives without anything causing Him to live.
Malbim: Then, all will recognize that their Father is alive and oversees His children with special wondrous Hashgachah. Via this, they endure during the long Galus. Goyim will know that they are seed that Hashem blessed.
I.e. there are living angels appointed over them. (PF)