Although it is usually not a legal requirement, it is generally suggested that employees give their employers at least 2 weeks' notice when they plan on leaving their jobs. The departure should be discussed with the person's manager in a professional manner. An employee may leave with no notice or less notice, but this can make it hard to get references from that employer later.
A person holding a key role in an organization may want to give the company more than 2 weeks' notice because that person's departure may negatively impact the organization. For example, a chief officer in a company may need to give a few months' notice. Having more notice will allow the employer to find a replacement and train the replacement employee.