Those who wished to dedicate themselves as a Nazarite could do so for any period, although the Mishna (a collection of Jewish oral law) suggests a period of 30 days. God's law permitted both men and women to take on this pledge (Numbers 6:2).
Those desiring to take the vow of a Nazarite had to be willing to sacrifice certain aspects of their life for the duration of their pledge. They had to abstain entirely from wine or drinking anything with alcohol in it (Numbers 6:3, see also Amos 2:12). In fact, those who decided to dedicate themselves to God as a Nazarite had to abstain from eating any grapes or any product made from them like juice, raisins and so on.
Those who were under the Nazarite vow could not shave any hair on their head (e.g. beard, mustache, eyebrows - Numbers 6:5, Judges 13:5, 16:17). This meant that those who promised to serve God in such a way were easily recognizable to other people, as they had long hair, bushy eyebrows, a long unkempt beard, etc.
A Nazarite was not permitted to come near a corpse, even if it was from a close family member, so that they would not be rendered unclean (Numbers 6:6 - 7).
After their period of dedicated service as a Nazarite ended, a person had to present burnt, sin and peace offerings at the temple (Numbers 6:13 - 21). They were then to shave their head and burn the hairs, after which they were allowed to return to a normal life.
Although they existed before the time of Moses, the first person specifically mentioned in the Bible as being a Nazarite is Samson (Judges 13:7, 16:17). He was among the very few dedicated as such from birth, along with Samuel (though not directly stated met the requirements - 1Samuel 1:11), and John the Baptist (Luke 1:15).
Some Biblical commentaries believe that Absalom, one of King David's sons, took the vow (see 2Samuel 14:26). The apostle Paul seems to have also dedicated himself in this special way at least twice, near the end of his second missionary journey (Acts 18:18) and just before the start of his fourth one (Acts 21:23 - 26).
The New Testament also mentions others who took this pledge of a Nazarite (Acts 21:23 - 24). One Christian tradition speculates that the Apostle James might also have taken this pledge (Eusebius, Ecclesiates History, ii. 23. 3).
While Jesus was raised in Nazareth (and hence called a Nazarene - Matthew 2:23) he was NOT a Nazarite. He practiced things that would not be permitted if he were under the vow.
For example, Jesus could not be a Nazarite because He drank wine, and did so frequently enough, that he was accused (falsely) of being a "winebibber" (Matthew 11:19, Luke 7:34) or drunk. Additionally, He also came close to or touched the dead bodies of at least three people (Luke 7:11 - 15, 8:49 - 55, John 11), which would have been forbidden to him had he had been a Nazarite.
The New Testament states that men were expected to have short hair (1Corinthians 11:14, 16). Since Christ never took up the Nazarite vow for himself, which would have allowed him to wear long hair, he almost certainly always wore his short (one proof the Shroud of Turin is a fake).