Devarim / Deuteronomy 31:12
הַקְהֵל אֶת־הָעָם הָאֲנָשִׁים וְהַנָּשִׁים וְהַטַּף וְגֵרְךָ אֲשֶׁר בִּשְׁעָרֶיךָ לְמַעַן יִשְׁמְעוּ וּלְמַעַן יִלְמְדוּ וְיָרְאוּ אֶת־יְהוָה אֱלֹהֵיכֶם וְשָׁמְרוּ לַעֲשׂוֹת אֶת־כָּל־דִּבְרֵי הַתּוֹרָה הַזֹּאת׃
Assemble the people, the men and the women and the little ones, and the stranger who is within your gates, so that they may hear and so that they may learn, and fear the Eternal your Almighty, and take care to do all the words of this Torah.
Pshat פְּשָׁט
Why carry the infants
Rashi: the men come to learn, the women to hear, and the children to give reward to those who bring them. Ramban: "so that they may hear and so that they may learn" is said of both men and women, for women too hear and learn to fear the Eternal. Chizkuni: after the shmita year everyone is free, the crop belongs to no one, and nobody needs to gather it in.
How Rashi, Ramban, and Chizkuni explain it
Remez רֶמֶז
Twice "so that"
Or HaChaim: the first "so that they may hear" is for everyone: both men and women must hear the commandments they keep. The second, "so that they may learn", is a separate part, the study of Torah, and that is the men's duty. Netziv: it does not say "so that they learn to fear". Fear of the Eternal enters the heart by itself when the Torah is heard at the assembly in the Temple.
How Or HaChaim and Haamek Davar explain it
Drash דְּרָשׁ
A pearl about children
Talmud: students came to Rabbi Yehoshua and retold Rabbi Elazar ben Azaryah's teaching: the men come to learn, the women to hear, and the children to give reward to those who bring them. Rabbi Yehoshua called it a pearl. Lekach Tov: the Eternal withholds reward from no creature. Hearing leads to learning, learning to fear, fear to doing.
How Ein Yaakov and Midrash Lekach Tov explain it
Sod סוֹד
A father's wish
Sefat Emet: even doing a commandment is a reward from the Eternal for a person's wish. A person's share is the wish and the awakening. A father's wish to draw his children to service brings reward, and the Eternal gives his children light. So too a simple person who cleaves to a tzaddik receives light through the tzaddik's wish. And everyone must give his wish over to the community.
How Sefat Emet explain it