The basic story of Chanukah as related in the Talmud is well known: The Greco-Syrians had occupied the land of Israel and subjugated the Jews. They passed laws that were meant to Hellenize the Jews and lead them to assimilate into Greek society and thereby abandon practicing Judaism. In addition, they defiled the Holy Temple in Jerusalem, abolishing the regular service the Jews performed there.
A handful of Jews, the Maccabees, under the leadership of Mattisyahu and his son Judah, took up arms against the Hellenized Jews and their foreign backers and defeated them on the battle field.
Following the victory, the Maccabees rededicated the Jerusalem Temple. Part of the service included lighting the golden candelabrum (menorah) each evening with ritually pure oil and letting it burn the entire night. However, only a small crucible of pure oil, enough for one night, was found. This oil miraculously burned for eight days. In commemoration of these events, the sages enacted the eight-day festival we celebrate as Chanukah.
The length of the holiday seems quite logical eight days in commemoration of an eight-day miracle. However, upon closer examination a slight problem can be seen. It is mentioned as early as the 12th century, but is most well known as the question of Rabbi Yosef Karo in his famous work, Beis Yosef: If there was enough oil to burn for one night and it miraculously burned for eight, the miracle was only for seven days, not eight. Therefore, why do we celebrate for eight days?
This vexing question has occupied the minds of some of the leading Jewish thinkers, particularly in the last few hundred years.
The variety of solutions has grown to the point that a recently published Hebrew-language book, Ner L'Mea, includes a collection of 100 different answers to this question.
The most fundamental answer is that the miracle of the oil was indeed only seven days long, and we actually commemorate it for only seven days. But it was not the only miracle we are celebrating by observing Chanukah. As is evident by looking at the special prayer, Al HaNissim, that is said on Chanukah, we also are celebrating the miraculous military victory. That alone, without the miracle of the oil, would have sufficed to create a holiday. Hence, one day is observed for the miracle is battle and seven days for the miracle of the oil.
Similar in nature to this answer, is that the "extra" day relates to the miracle of finding even that one jar of pure oil after the Greeks had defiled the entire rest of the Temple. The mere existence of the pure oil can be viewed as a miracle, as can the presence of even one ritually pure priest who was qualified to kindle the Temple's menorah.
Alternatively, the faith of the high priest in hiding it, and the faith of the Jews in searching for it are in themselves worthy of commemoration.
The "extra" day also may be viewed as commemorating the rededication of the altar, while the other seven are for the miracle of the oil. All of these answers assume a seven-day miracle, with seven days to commemorate it , plus and "extra" day for some other reason or miracle.
A number of answers are based on the fundamental Jewish principle that a miracle does not happen in a vacuum. Human effort must be expended and material substance must be present. To posit that the miracle was only seven days implies that not miracle whatsoever took place the first day. That would have required that all of the oil had been consumed the first day, leaving nothing on which the miracle could take place on subsequent days.
Various suggestions have been postulated to avoid this, all including a miraculous component on the first days as well. The possibilities include: The Maccabees divided the oil and used only an eight each day; the Maccabees poured out all the oil the first night but the cruse remained full; all the oil was used but the morning following the first night the candelabra was still full; or that the Maccabees poured all of the oil into the menorah but only an eighth was consumed each night all scenarios in which the first night was miraculous as well and the miracle of the oil was thus indeed eight days long.
There also is another more superficial answer which simply nullifies the question before it gets off the ground. It is based on a 10th century Gaonic text that relates the Chanukah story slightly differently from our version. It is stated there that the single jug of oil did not have enough oil to last even one day. Hence, the first night was just as miraculous as the other seven.
The opposite extreme recognizes the question as so cogent as to have no good answer. The miracle was really only seven days. However, extrinsic reasons may have played a role in establishing Chanukah as an eight-day holiday. For example, it is forbidden to make reproductions of the various objects and compounds which were used in the Temple. Hence, there are various restrictions on what sort of seven branched candelabrum one is permitted to make or maintain in one's house. To avoid such problems, the rabbis ordained Chanukah as eight days instead of seven.
Other suggestions link the Maccabees' rededication of the Temple, and our observance of it, with a previous Temple rededication. Just like King Hezekiah's rededication of the First Temple after his father's defilement of it was eight days long, so was the Maccabee rededication of the Second Temple eight days. It is immaterial that technically the miracle was only seven days. We are celebrating the rededication in general, not the oil miracle specifically, and hence celebrate for eight days all in anticipation of the future dedication of the Third Temple, which will never need a rededication.