The civil (or Julian) calendar is based on the cycle of the Earth around the sun. The length of this cycle, the solar year, is very close to 365 1/4 days.
The Hebrew calendar on the other hand is based on the cycle of the moon around the Earth. The length of this cycle, the lunar month, is about 29 1/2 days. Twelve lunar months make therefore about 354 days, which is 11 1/4 days shorter than the solar year.
In biblical times, the arrival of the new month was determined by watching the phase of the moon. However in modern times a fixed calendar is used in which the length of the months alternates between 29 and 30 days. Here are the names of the months in the Hebrew calendar:


The difference of 11 1/4 days between 12 lunar months and one solar year accumulates in three years to more than a month. If no adjustments are made, a summer month like Av or Elul could shift to the winter.
Because the Jewish holidays are closely related to the seasons (for example, the Torah commands to celebrate Pesach in the spring), an adjustment to the calendar must be made every few years. Every two or three years one extra month is added to a year. Such a year is called a leap year and it has two months of Adar.
Here are the months in a leap year:


Holidays that occur in the month of Adar (such as Purim) are celebrated in Adar 2 in a leap year. The same rule is applied to birthdays, anniversaries and other personal events.
The following 19 year cycle determines when a year is a leap year:
year kind  Cheshvan  Kislev  length of regular year 
chasera ("incomplete") 
29 days  29 days  353 
kesidra ("in order") 
29 days  30 days  354 
  30 days  29 days   
shleima ("complete") 
30 days  30 days  355 
The four constraints (Dechiot) that determine the exact year length have to do with the exact timing of the holidays in relation to the phase of the moon and with relations to the day of the week.
Dechia 1  Molad Zaken
The moon goes in orbit around the Earth. Every month, there is one instance in which the moon is exactly between the Earth and the sun and the Earth faces the dark side of the moon. This instance is called Molad ("birth" of a new moon) and it marks the beginning of a new month. The Molad of the first month of the year, Tishrei, marks the Jewish New Year or Rosh HaShana.
Since the Earth is facing the dark side of the moon, the moon becomes visible later that day or the next day.
In a year when the Molad of Tishrei occurs after 12:00 noon, Rosh HaShana is postponed until the next day because the moon would not become visible until the next day. This is done by adding one day to the previous year.
Dechia 2  Sunday, Wednsday, Friday
If the Molad of Tishrei falls on Sunday, Wednesday or Friday, Rosh HaShana is postponed by one day to Monday, Thursday or Saturday, respectively.
The reason is that if Rosh HaShana is on Wednesday or Friday, then Yom Kippur would occur on Friday or Sunday. That would make Yom Kippur adjacent to Shabbat (Saturday) and there would be two consecutive days in which it is forbidden to do any kind of work including the preparation of food.
If Rosh HaShana is on Sunday, Hoshana Raba would fall on Saturday and that would prevent the custom of 7 Hakafot.
Dechia 3  Molad of Regular Year on Tuesday
If the Molad of Tishrei of a regular year with 12 months occurs on Tuesday morning, Rosh HaShana would occur on Tuesday. However, this would cause a problem with Rosh HaShana of the following year.
To see why, remember that the length of a regular year can be 353, 354 or 355 days. If Rosh HaShana occurs on Tuesday, we can determine the day of Rosh HaShana of the following year by adding (daysinyear modulu 7) days to Tueday (number modulu 7 is the remainder resulting from dividing the number by 7).
year kind  days in year  modulu 7  next Rosh HaShana 
chasera ("incomplete") 
353  3  Tuesday + 3 = Friday 
kesidra ("in order") 
354  4  Tuesday + 4 = Saturday 
shleima ("complete") 
355  5  Tuesday + 5 = Sunday 
We can see from this table that if this year has 353 or 355 days, the next Rosh HaShana falls on Friday or Sunday, which contradicts constraint number 2.
Therefore this year must have 354 days and the next Rosh HaShana will fall on Saturday. However, the accurate length of a lunar month is 29 days, 12 hours, 44 minutes and 3 1/3 seconds. The accurate length of a lunar year (12 lunar months) is therefore 354 days, 8 hours, 48 minutes and 40 seconds. This means that if the Molad of this year occurs on Tuesday 6 AM, the Molad of the following year will occur on Saturday 2:48:40 PM, and Rosh HaShana will have to be postponed to Sunday according to constraint number 1 and then postponed again to Monday according to constraint number 2. In order to do that, this year will have to be 356 days long, which is not possible.
The conclusion of the above logic is constraint number 3 which states that if a Molad of a regular year occurs after Tuesday 3:22 AM, Rosh HaShana is postponed to Thursday.
Dechia 4  Molad of Leap Year on Thursday
This is a similar situation to the one described in contraint number 4. Here the rule is that if a Molad of a leap year occurs after Thursday 12:00 noon, the next Rosh HaShana is postponed from Monday to Tuesday.
Reference: Understanding the Jewish Calendar by Rabbi Nathan Bushwick. Moznaim Publishing Corporation, 1989.