Talmud Mesechta Shabbat asks, "Why Chanukkah?" and then procedes to tell the story of the miracle.
First we can ask, why is the question phrased this way?
If we look at the story as told in the Book of Macabees we see little (no) mention of the oil miracle. It is rather a military victory.
If we look at the Al Hanissim prayer we can discern two distinct parts. First we praise G-d about the military victory and only after that there is a tacked on sentence that they found oil and lit the menorah. But even there there is no mention of a miracle of eight days from one flask.
Chanukkah is listed in Megilat Taanit as one of the days when fasts are forbidden. Most of those holidays are no longer celebrated in any way, but channukka still is. Obvouisly once the Temple has been destroyed again all of those holidays, which were all minor military victories, become meaningless. What good is a victory when now we have no Temple?
So the question tyhe Talmud asks is why still celebrate Channukah now, when we have agian lost the war and have no Temple? To this is answers with the Miracle story.
The oral Torah, as represented by oil, wisedom, givng off light, is the balm to protect us in the exile against the influences of the "Greeks" and their culture.
the oral torah was written during the greek times. then names were given to statements as the idea of indivual significance was adopted from the greeks.
The miracle itself was know by very few people. who apart from the priests who were first on the scene could have known what transpired. Thus, the miracle was not worthy of being celebrated. Only public miracles are celebrated, not ones that took place in secret. See the ramban on the trials of Abraham and why they were not included in the Torah itself. There he states that since they were not public miracles they were not fit to be recorded.
So originally the prayer was about the military victory, but when that lost significance, the other less significant part of the event became central and it was added to the prayer. when the talmud asks why channukkah it is asking why should we still celebrate it today? why does it still bear any joy to us now that we have no Temple again? To this the answer is that these events gave us the Oral Law which is our guiding light in the exile. The oil is a symbol of wisdom and the oil not being made tameh means that Jewish wisdom was not tarnished by its exposure to Greek wisdom. That wisdom as expressed in the oral law lasts with us till today.
(See also how Maimonides refers to these event in his Yad)
(we also recall that the story in the talmud of the camel laden with straw that get lit by a menorah is a hint to the great greek empire which was burnt by a small flame, the Maccabees)
The talmud tells us that we must light until the last "footsteps leave the market". Is this a description of when to light or how long to light. For example, it could mean that we should light enough oil to burn from sunset time to the time people leave the streets (this could be a half hour in ancient times). So even if one were to light late in the evening he should put enough oil for this duration. Or it could mean that one is only permitted to light during the time frame from sunset until people leave the market. After that time period one can no longer light. The actually length of time to have the fire burn is therefore not defined.
The Rambam uses both these interpretations when formulating the halacha. Therefore , one must light during the period from sunset until dark (ideally), and one should burn the fire for at least a half hour, this same period, even if one lights later. The problem with this is what if the time periods change. For example, today people are in the streets from sunset till at least 10 o'clock. Therefore we could say that we can light even much later than sunset. Perhaps we should also put enough oil to burn the lights till much later too?
The Beis Yosef asks why is the miracle 8 days if they found enough oil for one day, then the miracle was only the other 7 days. The taz answers that even on the first day the oil did not finish, and was miraculously refilled. So the fact that it did not fully burn out the first day was also a miracle. Other commentators point out that burning oil not naturally produced (miracle oil) was not allowed. They propose that each day only 1/8th of the oil was consumed. A miracle each day.
My difficulty with this explanation is that normally the menorah was filled with oil and allowed to burn out. So that by sunrise each cup of oil had finished burning. Only the western flame was refilled and kept burning constantly. Each day the cohen would clean and fix each wick and refill the cup with oil. He was not permitted to blow out the lights. All the oil needed to be burned. So what happened in the morning of the first day of chanukkah? At sunrise the oil was not finished and the flame had blown out. So then he should relight the flame. Or, the light was still burning and the oil was still there (maybe he used a thin wick). So he let it go on burning, not knowing it would not finish. So the actual miracle was that enough oil for a 14 hour burning of the menorah burned for 7 x 24 + 14 hours.
Also interesting is that in the times of the hanukkah story the western light never went out even without being refilled. It always miraculously kept burning. So the miracle of channukah was that this behavior extended to the all the lights of the menorah. Really, they were used to miracle with the menorah.
Other reasons why chanukkah is eight days: 1. Sukkot was not held that year and was delayed until chanukkah. 2. the original dedication of the altar in the Torah was eight days.