Nazir, Chapter 3, Mishnah 3. This mishnah is built on the halachah taught in the first mishnah of the chapter: one who takes a vow of nezirus for thirty days explicitly - that is, he specifies that this is not an unspecified nezirus but a nezirus of thirty days - if he shaved on the thirtieth day he has not fulfilled his vow, and he must go back and count his nezirus again.
Becoming tamei on the thirtieth day of an unspecified nezirus:
"Mi she'amar hareini nazir" - one who said, "I am hereby a nazir," an unspecified nezirus, which is thirty days. "Nitma b'yom sheloshim - soser es hakol" - the thirtieth day is the day on which he could have brought his offerings, at least after the fact; nevertheless, if he became tamei on that day, his entire nezirus is void and he must begin counting anew. This is exactly like one who became tamei in the middle of his nezirus, on the fifteenth day for example, and there is no difference at all between the cases.
The reason is this: although the previous mishnah mentioned the principle of "miktzas hayom k'chulo" - that part of the day counts as the whole day - this principle applies only after the offerings have been brought. As long as he has not shaved and has not brought his offerings, the first Tanna considers him to be standing in the middle of his nezirus.
"Rabbi Eliezer omer: eino soser ela shivah" - Rabbi Eliezer disagrees and holds that in an unspecified nezirus, one who became tamei on the thirtieth day loses only seven days, and in practice nothing of the nezirus itself is lost. For one who came into contact with a corpse is in any case required to undergo seven days of purification, and once he has become tahor he may bring his offerings. In his view we say "miktzas hayom k'chulo" even before the offerings of that day have been brought, and therefore he is like one who became tamei after completing his nezirus: all he must do is become tahor and bring his offerings, and none of the nezirus is nullified.
Becoming tamei on the thirtieth day of an explicit thirty-day nezirus:
"Hareini nazir sheloshim yom" - here we are not dealing with an unspecified nezirus, but with an explicit acceptance of thirty days of nezirus. As mentioned in the first mishnah of the chapter, one who vows an explicit thirty days cannot bring his offerings on the thirtieth day, not even after the fact. Therefore the thirtieth day is considered, even according to Rabbi Eliezer, to be the middle of the nezirus, and so "nitma yom sheloshim - soser es hakol" - one who became tamei on this day nullifies his entire nezirus and counts again from the beginning, since he became tamei literally in the middle of his nezirus.
In summary: in this mishnah we learned the law of one who becomes tamei on the thirtieth day. In an unspecified nezirus the Tannaim disagree: according to the first Tanna he loses everything, since "miktzas hayom k'chulo" was said only after the offerings have been brought; and according to Rabbi Eliezer he loses only seven days, which are merely the days of purification. But in a nezirus of thirty explicit days, in which there is no possibility of bringing offerings on the thirtieth day even after the fact, he loses everything - even according to Rabbi Eliezer.