The Talmud (P’sachim 71a, Succah 48a) tells us that even though the Torah tells us (D’varim 16:14-15) that on Succos we should rejoice for seven days, we are also supposed to rejoice on the night of the eighth day (the night after the seventh day ends, when Sh’mini Atzeres starts). This is learned from the extra mention of “rejoicing” (in 16:15), a mention that includes an exclusionary term that teaches us that we are not required to rejoice on the first night of Succos.
What about on the eighth day itself? In P’sachim, Rashi tells us that the mitzvah to rejoice, which is fulfilled by bringing an offering to G-d in the Temple and partaking of its meat, does not apply to the eighth day, since the Torah says — twice — that we should rejoice for seven days, with the implication being only for seven days, not eight. However, in Succah, Rashi tells us that we are required to rejoice on the eighth day as well, as the day is more important than the night, and if we are required to rejoice on the night of the eighth, we are surely required to rejoice during the eighth day too. How can Rashi say in one place that the eighth day is excluded from the requirement to rejoice yet in another place tell us that the eighth day must surely be included in the requirement?
It is quite common for Rashi to explain each piece of the Talmud “locally,” i.e. presenting the most straightforward way of understanding what the Talmud is saying even if it seems to contradict something the Talmud says elsewhere. Typically, Tosfos will raise such issues by referencing what the Talmud says elsewhere, often offering an alternative understanding of what the Talmud is saying in order to resolve these inconsistencies, but Rashi does not usually deal with such things in his explanation. Therefore, whenever Rashi explains what seems to be parallel Talmudic discussions differently, the first step is to look at the context of the Talmud in each citation; if the context of one lends itself to one explanation and the context of the other lends itself to a different explanation, Rashi will likely present differing explanations in order to present the most straightforward explanation of each — independent — Talmudic piece.
In P’sachim, the Talmud’s focus is on Rabbi Elazar’s contention, based on D’varim 27:7, that the meat consumed in order to fulfill the Torah’s requirement to rejoice must be slaughtered when the requirement to rejoice is active. If, however, the animal was slaughtered before the requirement started, which in our case means before Succos, eating its meat on Succos would not fulfill the requirement. The Talmud then quotes a Tannaic teaching that seems to support Rabbi Eliezer’s view, that the mitzvah to rejoice does not apply on the first night of Succos. Since offerings cannot be brought at night, the only way one can “rejoice” (read: eat the meat of an offering) is if the offering was slaughtered before Succos started. But if the mitzvah to rejoice cannot be fulfilled with an offering slaughtered before the mitzvah could be done, obviously there is no way for there to be a requirement to rejoice on the first night of Succos.
Although the Talmud rejects this line of thinking, as there are other reasons why there is no requirement to rejoice on the first night and there is a requirement to do so on the eighth night, it is within his explanation of the Talmud’s attempt to support Rabbi Elazar that Rashi tells us there is no requirement to rejoice on the eighth day. And it would seem that according to Rabbi Elazar, this has to be true, as if there was a requirement to rejoice on the eighth day too, why would the Torah only tell us (explicitly) to rejoice for seven days? Normally, we would say that the Torah first mentioned seven days of rejoicing followed by an extra mention of rejoicing — along with an exclusionary term — in order to exclude the first night from the requirement while including the eighth day, but according to Rabbi Elazar, we don’t need to specifically exclude the first night, as it is automatically excluded based on (from his perspective) the verse that tells us we cannot rejoice with meat slaughtered before Succos started; even had the Torah told us explicitly to rejoice for eight days, the first night would have been excluded. According to Rabbi Elazar, if the Torah wanted us to the rejoice on the day too, it could have said so explicitly. Therefore, when explaining the Talmud’s attempt at supporting Rabbi Elazar, Rashi had to say that, according to him, there is no requirement to rejoice on the eighth day.
Ultimately, the Talmud concludes that there is no need to slaughter the offering during the time that the mitzvah to rejoice applies, so there is no need for Rashi to stick with the way he explained things according to that rejected opinion when he explains the same Tannaic teaching elsewhere. But more than that, Rashi has to explain the Talmud in Succah differently, as the point of the Talmud there is to understand the Mishnah’s requirement to rejoice for eight days! Even though the Torah only mentions seven days explicitly, since there is an extra mention of “rejoicing,” the eighth day is included as well. The mechanics of how we get to a requirement of rejoicing for eight days includes the exclusionary term that is applied to the first night of Succos, which is why we are first told to rejoice for seven days before part of that period is excluded and another day (or day-part) is added. And once part of the eighth day was added to the requirement to rejoice, the whole day is included. The limitation on including the eighth day that Rashi had to incorporate when explaining Rabbi Elazar does not apply here, and in order to explain the Talmud’s presentation of why we must rejoice for eight days, he had to explain how the eighth day was included as well.