Bamidbar31:2

נְקֹם נִקְמַת בְּנֵי יִשְׂרָאֵל מֵאֵת הַמִּדְיָנִים אַחַר תֵּאָסֵף אֶל־עַמֶּיךָ׃

"Avenge the children of Israel on the Midyanites. Afterward you shall be gathered to your people."

Bamidbar 31:2

נְקֹם נִקְמַת בְּנֵי

Bamidbar / Numbers 31:2 · Remez

Bamidbar 31:2

נְקֹם נִקְמַת בְּנֵי יִשְׂרָאֵל מֵאֵת הַמִּדְיָנִים אַחַר תֵּאָסֵף אֶל־עַמֶּיךָ׃

"Avenge the children of Israel on the Midyanites. Afterward you shall be gathered to your people."

Remez רֶמֶז

Whose vengeance is it

Moshe (Moses) passes the command on to the people but changes one word in it. The commentators see a lesson both in this change and in where the story stands in the Torah.

Kitzur Ba'al HaTurim: the command of vengeance stands right after the laws of vows: in distress people make vows, and one who brought another to sin answers for it all the more. Rabbeinu Bahya: the Eternal said "vengeance for the children of Israel", but Moshe told the people "the vengeance of the Eternal": Israel is hated for the Torah, so whoever rises against Israel rises against the Almighty.

How Kitzur Ba'al HaTurim and Rabbeinu Bahya explain it

Kitzur Ba'al HaTurim Avenge the children of Israel

This stands next to the section on vows, to tell you that people make vows in a time of distress and war. And they also said: one who kept silent to his daughter and his wife and did not annul their vows takes their place himself. All the more will the Midyanites, who led Israel into sin, be punished.

Rabbeinu Bahya Afterward you shall be gathered

Some say: you will see vengeance on your enemies and rejoice. And they said in the midrash: the Holy One, blessed is He, said "vengeance for the children of Israel", and Moshe (Moses) said "the vengeance of the Eternal". Moshe said to the Holy One, blessed is He: "Master of the world, if we were uncircumcised or served idols, they would not hate us. Why do they hate us? For the Torah and the commandments You gave us. The vengeance is Yours." Therefore he said: "to execute the vengeance of the Eternal on Midyan": whoever rises against Israel is as if he rises against the Holy One, blessed is He.

Takeaway

The law of one who kept silent and did not annul a vow is in this same portion: "then he shall bear her iniquity" (Bamidbar / Numbers 30:16).
The Eternal's words: "Avenge the children of Israel" (Bamidbar / Numbers 31:2). Moshe's words to the people: "to execute the vengeance of the Eternal on Midyan" (Bamidbar / Numbers 31:3).