Kiddushin 16 - How Hebrew Servant Regains His Freedom
A Hebrew servant sold by the courts can gain his freedom back in one of four ways:
completion of six years of service; the onset of the Jubilee year; paying his purchase price back to his master, minus the cash equivalent of the years already served; death of his master. A Hebrew maidservant sold by her father, in addition to all the ways of a Hebrew servant, goes free when she reaches twelve years of age and has "signs of physical maturity" (two pubic hairs).
When a Hebrew servant or maidservant go free, they receive severance gifts.