"And he gave them into the hand of his servants, every drove by itself" (Genesis 32:17). Why did he not bring them in all mixed together? In order to astonish him [Esau] at the size of his gift. And why did he not bring them all in at once? In order to fill the eyes of that wicked man: one drove comes to an end, and Jacob's man says, "Accept it"; another comes to an end, and he says, "Accept it." "And the gift passed over before him" (Genesis 32:22) - he too was in distress. "And he rose up that night and took his two wives" (Genesis 32:23). And where was Dinah? He placed her in a chest and locked it before her. He said: That wicked man's eye is haughty; perhaps he will lift his eyes and see her and take her from me. The Holy One, blessed be He, said to him: "To one in despair, kindness is due from his friend" (Job 6:14) - you withheld your kindness from your brother. You would not give her to him as a wife and bring him under the wings of the Divine Presence. Since you would not let her be married in a permitted way, she will be taken by way of transgression. This is what is written: "And Dinah, the daughter of Leah, went out" (Genesis 34:1).
Why Jacob Sent the Herds Apart and Hid Dinah in a Chest
Yalkut Shimoni on Torah 131:8
וַיִתֵּן בְּיַד עֲבָדָיו עֵדֶר עֵדֶר לְבַדּוֹ. לָמָּה לֹא הִכְנִיסָן בְּעִרְבּוּבְיָא כְּדֵי לְתָמְהוֹ עַל דּוֹרוֹן שֶׁלוֹ וְלָמָּה לֹא הִכְנִיסָן כֻּלָּן כְּאֶחָד כְּדֵי לִשְׂבֹּעַ עֵינָיו שֶׁל אוֹתוֹ רָשָע אָתֵי לְמֵחְסַל וְהוּא אָמַר קַבֵּל אָתֵי לְמֵחְסַל וְהוּא אָמַר קַבֵּל. (בראשית לב כב) וַתַּעֲבֹר הַמִּנְחָה עַל פָּנָיו, אַף הוּא הֲוָה בְּעָקָא. (בראשית לב כג) וַיָּקָם בַּלַּיְלָה הוּא וַיִּקַּח אֶת שְׁתֵּי נָשָׁיו, וְדִינָה הֵיכָן הָיְתָה, נְתָנָהּ בְּתֵיבָה וְנָעַל בְּפָנֶיהָ, אָמַר, עֵינוֹ שֶׁל אוֹתוֹ רָשָׁע רָמָה הִיא שֶׁמָּא יִתְלֶה עֵינָיו וְיִרְאֶה אוֹתָהּ וְיִקַּח אוֹתָהּ מִמֶּנִּי. אָמַר לוֹ הַקָּדוֹשׁ בָּרוּךְ הוּא "לַמָּס מֵרֵעֵהוּ חָסֶד", מָנַעְתָּ חַסְדְּךָ מִן אָחוּךְ וְנָסַבְתָּהּ לְאִיּוֹב וְלֹא גִּיַּרְתֵּיהּ לֹא בִּקַּשְׁתָ לְהַשִּׂיאָהּ לְמָהוּל הֲרֵי הִיא נִשֵׂאת דֶּרֶךְ אִסּוּר, הֲדָא הוּא דִּכְתִיב (בראשית לד, א) "וַתֵּצֵא דִינָה בַּת לֵאָה".