"And by Him deeds are weighed" (1 Samuel 2:3). We do not know whether [the meaning is] "by Him deeds are weighed", or whether [it means] deeds that are not directed toward Him. Scripture therefore teaches: "He made known His ways unto Moses, His deeds unto the children of Israel" (Psalms 103:7). "The bow of the mighty men is broken, etc." (1 Samuel 2:4) — [rendered in Aramaic:] the bow of the mighty men is broken, and the weak have inherited their strength. "They that were full have hired themselves out for bread" (1 Samuel 2:5) — this is Peninnah, who was full of sons, yet she hired herself out. "And they that were hungry have ceased" — Hannah, who was hungry for sons, ceased. How is this so? Rabbi Yehudah and Rabbi Nehemiah [explained]. Rabbi Yehudah says: grandchildren are like children. Rabbi Nehemiah says: Peninnah had ten sons. Hannah would bear one, and Peninnah would bury two; Hannah would bear two, and Peninnah would bury four; three, and Peninnah would bury six; four, and Peninnah would bury eight. When she passed the fifth, Peninnah came and prostrated herself at her [Hannah's] feet. She said to her: "I beg of you, pray for [the remaining] two, that they may live." She prayed for them, and they were called by her [Hannah's] name.
Hannah's Sons and Peninnah's Buried Children in Midrash Shmuel
Midrash Shmuel 5:10
ולו נתכנו עלילות (שמואל א' ב' ג'), אין אנו יודעין אם לו נתכנו עלילות, אם עלילות שאינן מכוונות לו תלמוד לומר יודיע דרכיו למשה לבני ישראל עלילותיו (תהלים ק"ג ז'). קשת גבורים חתים וגו', איתברת קשתהון דגיבריא ותשישיא אחסינו חיליהון. שבעים בלחם נשכרו. זו פנינה שהיתה שבעה בבנים ונשתכרה. (אלא) ורעבים חדלו, חנה שהיתה רעבה מבנים חדלה, הא כיצד רבי יהודה ורבי נחמיה, רבי יהודה אומר בני בנים כבנים, רבי נחמיה אומר היה לפנינה עשרה בנים, היתה חנה יולדת אחד, ופנינה קוברת שנים, חנה יולדת שנים ופנינה קוברת ארבעה, שלשה ופנינה קוברת ששה, ארבעה ופנינה קוברת שמונה, כיון שעברה חמישי, באתה פנינה ונשתטחה על רגליה, אמרה לה בבקשה ממך התפללי על שנים ויחיו, התפללה עליהן והיו נקראין על שמה.