Since Hashem instructed Moshe to take vengeance against the Midianites, why did Moshe send someone else?
(31,2) “Avenge the vengeance of the Children of Yisrael from the Midianites; afterwards you shall be gathered to your people.”
The midrash asks that since Hashem told Moshe that he himself was to take vengeance against the Midianites, why did Moshe send someone else to carry it out instead?
The midrash brings two answers to this question, but another explanation is that Moshe knew that the wicked Bilaam must die in this war, and he also knew that he must be killed specifically by the sword which is the characteristic of “the hands are the hands of Eisav”. This was in order that Bilaam’s punishment would be a measure-for-measure punishment. He swapped his tradecraft of “the hands are the hands of Eisav” - using physical force to achieve his goal, for the tradecraft of Yisrael “the voice is the voice of Ya’akov” - using speech (cursing) to achieve his goal. Therefore Yisrael had to also swap their tradecraft of prayer and kill him by the sword, a measure-for-measure punishment.
This is why Moshe told Yisrael to “avenge the vengeance of Hashem from Midian” - the vengeance of Hashem, because He metes out a measure-for-measure punishment - and thus they were to kill Bilaam by the sword. But Hashem said to Moshe to “avenge the vengeance of the Children of Yisrael”, to take vengeance using the tradecraft of Yisrael and kill Bilaam using the voice, with prayer. From this Moshe understood that it was Hashem’s will that he not go to war himself, but rather that he should remain in the camp to wage war with prayer. And the reason for this was because Moshe constituted all of Yisrael, and so if he also waged war with the sword, with the characteristic tradecraft of “the hands are the hands of Eisav”, Yisrael’s characteristic tradecraft of “the voice is the voice of Ya’akov” would become annulled completely, G-d forbid.
Therefore, Hashem told Moshe that he himself should “avenge the vengeance of the Children of Yisrael” - to use his voice to wage war, and to send others to fulfill the “vengeance of Hashem” - to wage the war with the sword, and this was Hashem’s intention from the beginning.
For the same reason Moshe sent Yehoshua to wage war with Amalek rather than go himself, because he remained in the camp in order to wage war with prayer. As it says “when Moshe raised his hand Yisrael prevailed” (Shemos 17:11) - this refers to prayer (Rosh Hashanah 29a) - “and Yehoshua weakened Amalek and his people with the mouth (the edge) of the sword (לפי חרב)” (Shemos 17:13). Notice that it does not say more briefly לחרב (with the sword), because the Torah wishes to tell us that the mouth of Moshe and the sword of Yehoshua together weakened Amalek.
Why did the soldiers who returned from the war with Midian need to repent?
(31,51) “And Moshe and Elazar the Kohen took the gold from them, every fashioned vessel (כל כלי מעשה).”
To understand the word מעשה which appears to be superfluous, behold, the returning soldiers said that they had not succeeded in having no bad thoughts. But now that they had repented, their bad thoughts became good thoughts, and since Hashem joins a good thought to a deed, their bad thoughts became a good deed.
This is the meaning of כל כלי מעשה - their repentance for bad thoughts had been accepted (the word כלי can mean thoughts, as in “בנכליהם אשר נכלו - with their plots which they contrived” (Bamidbar 25:18)) and were now considered a good deed.