If you go out to war: The verse here is referring to an optional war [i.e., non-obligatory] (Sifrei 21:1), since in reference to the [obligatory] war [to conquer] the land of Israel, it would be inappropriate to say “and you take his captives” because it has already been stated [regarding the seven nations of Canaan],“[from these peoples’ cities…] you shall not allow any soul to live.” (Deut. 20: 16).

[and you desire her,] you may take [her] for yourself as a wife: [Not that you are commanded to take this woman as a wife,] but Scripture [in permitting this marriage] is speaking only against the evil inclination [, which drives him to desire her]. For if the Holy One, blessed is He, would not permit her to him, he would take her illicitly. [The Torah teaches us, however, that] if he marries her, he will ultimately come to despise her, as it says after this, “If a man has [two wives-one beloved and the other despised]” (verse 15); [moreover] he will ultimately father through her a wayward and rebellious son (see verse 18). For this reason, these passages are juxtaposed. — [Tanchuma 1]

and let her nails grow: Heb. וְעָשְׂתָה אֶת-צִפָּרְנֶיהָ. She must let them grow, so that she should becomes repulsive [to her captor, to induce him to change his mind about marrying her]. — [Sifrei 21:7, Yev. 48a]

ועשתה את צפרניה: תגדלם כדי שתתנוול:

13And she shall remove the garment of her captivity from upon herself, and stay in your house, and weep for her father and her mother for a full month. After that, you may be intimate with her and possess her, and she will be a wife for you.

And she shall remove the garment of her captivity: [so that she should not be attractive to her captor,] for they are pretty [clothes], because gentile women adorn themselves during wartime, in order to seduce others [namely, the enemy] to have relations with them. — [Sifrei 21:8]

and stay in your house: In the house he uses. Upon entering, he will stumble upon her, and upon leaving, he will stumble upon her, see her weeping and see her unsightly appearance-all this, so that she should become despicable to him. — [Sifrei 21: 9]

and weep for her father and her mother: Why is all this necessary? So that an Israelite woman [i.e., this man’s Jewish wife] should be happy, and this [gentile captive woman] should be grief-stricken, an Israelite woman should be dressed up, and this one should make herself repulsive. — [Sifrei 21:11]

And it will be, if you do not desire her: Scripture informs you that eventually you will despise her. — [Sifrei 21:14.

והיה אם לא חפצתה בה: הכתוב מבשרך שסופך לשנאותה:

You shall not keep her as a servant: Heb. לֹא-תִתְעַמֵּר בָּהּ. [This means:]“You must not use her [as a slave]” (Sifrei 21:16). In the Persian language, the term for slavery and servitude is עִימְרָאָה [the term used here]. I learned this from the Yesod of Rabbi Moses the Darshan.

16Then it will be, on the day he [the husband] bequeaths his property to his sons, that he will not be able to give the son of the beloved [wife] birthright precedence over the son of the despised [wife]-the [real] firstborn son.

17Rather, he must acknowledge the firstborn, the son of the despised [wife] and give him a double share in all that he possesses, because he [this firstborn son] is the first of his strength, then he has the birthright entitlement.

a double share: [The firstborn son takes a share] equal to that of two brothers [together]. — [Sifrei 21:28]

פי שנים: כנגד שני אחים:

[and give him a double share] in all that he possesses: From here [we learn that] the firstborn son does not take [a double share] from that which [the father’s estate] is entitled to after the demise of the father, [e.g., from an uncollected debt,] as [he does] from what was in the father’s actual possession. — [Sifrei 21:29, Bech. 51b]

they shall chasten him: They must warn him in the presence of three [people, not to steal, nor to eat a certain quantity of meat and drink a certain quantity of wine (see further in Rashi)], and then they must have him flogged [by the court] (San. 71a; see Sifrei). [The Talmud (San. 71a) emends this to read: They must warn him in the presence of two (witnesses) and have him flogged in the presence of three (judges).] The wayward and rebellious son incurs punishment only if he steals [money from his father], consumes [at one meal] a tartemar [a weight equal to half a maneh] of meat, and drinks [at the same meal] half a log of wine, as it is said [referring to him], “a glutton and a guzzler (זוֹלֵל וְסֹבֵא)” (verse 20), and [elsewhere] it says, “Do not be among wine-guzzlers (בְסֹבְאֵי-יָיִן), among gluttonous eaters of meat (בְּזֹלְלֵי-בָשָׂר)” (Prov. 23:20), [which indicates that the term “guzzler” refers to wine and “glutton” refers to meat] (San. 70a, Sifrei). The wayward and rebellious son is executed on account of [what he will become in] the end-the Torah penetrates to his ultimate intentions. Eventually, he will squander his father’s money, seek what he has become accustomed to, not find it, and stand at the crossroads and rob people [killing them, thereby incurring the death penalty. Says the Torah, “Let him die innocent [of such crimes], rather than have him die guilty [of such crimes].” - [San. 72b]

and all Israel will listen and fear: From here, [we learn that] the court must make a public proclamation, announcing: “So-and-so has been stoned because he was a wayward and rebellious son!” - [San. 89a]