The Hebrew calendar is a lunar calendar which uses the Metonic cycle (yes, we stole it from the Ancient Greeks; but at least we kept it). The length of a lunar month is ~29.5 days, so months (essentially; there are some changes but they don't influence the length of the year) alternate 29 and 30 days.

This gives 354 days a year, instead of the ~365.24 you need to keep in sync with the solar calendar. So 7 out of 19 years get an extra month -- Adar becomes Adar 1 followed by Adar 2.

The rule for determining if a year is a leap year is simple: just determine the year (counting from epochial Creation, 5761 years ago) modulo 19. If the remainder is 0, 3, 6, 8, 11, 14 or 17 then it's a leap year.

This gives a solar calendar slightly more accurate than the Gregorian calendar.

Moral:

Given a choice of Greeks or Romans, go with the former.