Note: these notice periods apply to employees resigning or retiring – different rules apply to notice periods for dismissal (you can find these in the Burgundy Book).
Statutory and contractual notice periods
Check your headteacher's contract first, as it should include their notice period.
Statutory notice periods for headteachers in maintained schools are set out in the Burgundy Book (the Conditions of Service for School Teachers in England and Wales, hosted on the National Education Union's website - scroll down to the 'Key documents' section). Academies, foundation and voluntary-aided schools don't have to follow this, but most do.
Headteachers are required to give 3 months' notice in the autumn and spring terms and 4 months in the summer term. See pages 4 and 5 of the Burgundy Book, linked above.
The deadlines set out in the Burgundy Book