This article is from the Calendars FAQ, by Claus Tondering claus@tondering.dk with numerous contributions by others.
Leap years have 13 months. To determine if a year is a leap year,
calculate the number of new moons between the 11th month in one year
(i.e., the month containing the Winter Solstice) and the 11th month in
the following year. If there are 13 new moons from the start of the
11th month in the first year to the start of the 11th month in the
second year, a leap month must be inserted.
In leap years, at least one month does not contain a Principal Term.
The first such month is the leap month. It carries the same number as
the previous month, with the additional note that it is the leap
month.
 
Continue to: