We are in chapter 6 of Maseches Nazir, mishnah 3. The mishnah opens by quoting a halachah we already learned in the first chapter: "Stam nezirus sheloshim yom" - a person who accepts nezirus upon himself without specifying how long it should last is a nazir for thirty days.
From here we derive a measure: the amount of hair growth required of a nazir is thirty days at the very least. Therefore, if the nazir shaved his hair or cut it, or if robbers overpowered him and shaved his hair, this cancels thirty days, meaning that he must wait an additional thirty days before he can complete his nezirus. The reason is this: when he comes to fulfill the mitzvah of shaving at the conclusion of his nezirus, which is part of the mitzvos of the Torah, he must have thirty days' growth of hair at the very least. Once he has lost his hair - whether he himself transgressed or others did it to him - he must produce thirty days of growth.
A dispute among the commentators regarding the parameters of the thirty days:
The thirty days apply specifically to a nezirus of thirty days. But if he accepted a nezirus of sixty days and more than thirty days still remain, there is no need to add on, since in any case he will have more than thirty days' growth of hair.
This is an absolute addition: even in a very long nezirus, since the loss of hair occurred at that moment, he must add thirty days. According to this opinion, when we say that this cancels thirty days, he must observe all the components of nezirus during those thirty days, but they do not count as nezirus while the hair grows back.
The parameters of the prohibition of shaving the hair:
The mishnah continues and spells out what is required to transgress the prohibition of shaving the hair during the days of nezirus: "Nazir shegilach bein bezug bein bata'ar, o shesaf se'ar kol shehu - chayav" - a nazir who shaved his hair intentionally is liable to lashes, and this applies in each of the following ways:
"Bein bezug" - whether he used a zug, which is a scissors.
"Bein bata'ar" - or whether he used a razor.
"O shesaf se'ar kol shehu" - and even if he merely plucked a single hair out by its root with his hand.
The Gemara explains the measure: if he plucked a hair from the root in such a way that not enough remained for the hair to be able to bend over, he has transgressed the prohibition. But if he left over enough hair for it to be able to bend over, there is no transgression.
It is worth distinguishing between two matters: everything said until now was said regarding lashes, that is, regarding becoming liable. But regarding cancellation, mentioned at the beginning of the mishnah - that he cancels thirty days - this is relevant only if he shaved off the majority of the hair on his head.
"Chofef umefaspes aval lo sorek":
The mishnah says that a nazir "chofef umefaspes" - he is permitted to scratch and rub his hands through his hair, even though a hair may be uprooted. The reason for the leniency: even if a hair is uprooted, this is an unintended act, and it is not a pesik reisha - there is no certainty that it will happen. Therefore he may perform these actions on his hair, as long as he does not intend to uproot hair.
"Aval lo sorek" - he may not comb his hair, since combing the hair with a comb certainly uproots at least one hair.
Rabbi Yishmael says: "Lo yachof ba'adamah, mipnei shemashir es hase'ar" - he may not wash his hair with the earth or mineral that people used for cleaning the hair, because that earth has the power to remove hair, and since it will certainly cause several hairs to fall out, this constitutes a transgression for a nazir.
In summary: In this mishnah we learned that "stam nezirus sheloshim yom," and from here comes the measure of hair growth required of a nazir - thirty days at the very least. Accordingly, one who loses his hair cancels thirty days, and the commentators disagree as to whether this applies specifically to a nezirus of thirty days or to every nezirus. We also learned the parameters of liability for shaving - with a scissors, with a razor, or by plucking out even a single hair from its root - and the distinction between liability to lashes and cancellation, which depends on shaving the majority of the head. Finally, we clarified the permission to wash and rub the hair, based on an unintended act that is not a pesik reisha, and the prohibition of combing and of washing with earth, in which the uprooting of hair is certain.