You don't have to give you employer any notice but there are drawbacks to not giving proper notice. Employers have the right to withhold any perks they may extend to someone who gave appropriate notice (sometimes employers request 1 months notice or more for key positions). These perks include having sick/vacation/personal time paid out to the employee, the ability to be rehired by the company, or having the employer act as a professional reference in the future.
Although how an employee leaves is confidential, enough people know or can deduct if your termination from employment was positive and negative which has an impact on your reputation. In some fields, reputation is everything.
Giving 2 weeks isn't mandatory but it is a courtesy that is expected. You will most likely not be replaced within 2 weeks- that is a very short amount of time but the employer at least has a jump start into replacing you before you stop working to avoid a great impact on their operations.