The explanation of the matter: When they purified the Mikdash, and they were all tamei met from the war, and a tamei met cannot be purified except after seven days through sprinkling on the third and seventh, and one day for the preparation of tahor oil (Beit Yosef). Furthermore: that there was tahor oil at a distance of four days, and until they would go and return, eight days would pass (Ran ibid.). And they had nothing with which to light the Menorah. And they offered all the sacrifices of the Temidim, for a communal sacrifice overrides tumah. Therefore, they were also able to light the lamps of the Menorah for this reason, for the lighting of the Menorah also overrides tumah, as is taught in Torat Kohanim, Parashat Emor (end of Parasha 13): "'He shall arrange the lamps before Hashem continually' – 'continually' even on Shabbat, 'continually' even in tumah." However, the oil was required to be tahor, for tumah was not permitted for the community except for tumat met, and not other types of tumah, as is explained in Pesachim (67a). And the oils were defiled by other types of tumah, from their touch and from their carriage. And all the olives were defiled, until they could obtain from those still attached to the tree which do not receive tumah, and the eight days would pass. Therefore, when they found this flask sealed with the seal of the Kohen Gadol, and it was placed in the depths in a manner that they also did not move it, for if not so, they would have defiled it through hesset (Tosafot Shabbat ibid.). Furthermore: that had they seen them – they certainly would have taken it, for they would have imagined that there were precious stones there (Ran ibid.). And the Holy One, Blessed be He, performed a miracle for them, that even though there was only enough for one day – they lit from it for eight days, until they produced tahor oil. Therefore, they established eight days for Hallel and thanksgiving. (See Bach, and according to what I have written, it works well with simplicity.)
ביאור הדברים: שכשטיהרו את המקדש, והיו כולם טמאי מתים מהמלחמה, וטמא מת לא יכול לטהר רק אחר שבעה ימים בהזאת שלישי ושביעי, ויום אחד להכנת שמן טהור (בית יוסף). ועוד: שהיה שמן טהור בריחוק ארבעה ימים, ועד שילכו ויבואו יעברו שמונה ימים (ר"ן שם). ולא היה להם מה להדליק בהמנורה. וכל הקרבנות של התמידים הקריבו, דקרבן ציבור דוחה את הטומאה. ולכן גם היו יכולין להדליק את הנרות שבמנורה מטעם זה, דגם הדלקת המנורה דוחה את הטומאה, כדתניא בתורת כוהנים פרשה אמור (סוף פרשה יג): "יערוך את הנרות לפני ד' תמיד" – "תמיד" אף בשבת, "תמיד" אף בטומאה. ורק דשמן היה מוכרח להיות טהור, דלא הותרה טומאה בציבור רק טומאת מת, ולא שארי טומאות, כמבואר בפסחים (סז א). והשמנים נטמאו מטומאות אחרות, ממגען וממשאן. וכל הזיתים נטמאו, עד שישיגו ממחוברים שאין מקבלין טומאה, ויעברו השמונה ימים. ולכן כשמצאו זה הפך החתום בחותמו של כהן גדול, והיה מונח בעומק באופן שגם לא הסיטו אותו, דאם לא כן היו מטמאין בהיסט (תוספות שבת שם). ועוד: דאלו היו רואים אותם – בוודאי היו נוטלין אותו, שהיו מדמין שיש שם אבנים טובות (ר"ן שם). והקדוש ברוך הוא עשה להם נס, שאף על פי שלא היה רק ליום אחד – הדליקו ממנו שמונה ימים, עד שעשו שמן טהור. ולכן קבעו שמונה ימים להלל והודאה. (עיין ב"ח, ולפי מה שכתבתי אתי שפיר בפשיטות.)