Here's some more detail. In particular, Adar II does not happen every 4 years. Here's how the calendar works:

The month-length is taken to be 29 days, 12 hours, and 793 "parts," where a "part" is 1/1080 of an hour, or 1/25920 of a day, or 3-1/3 seconds. This is taken to be the mean length of a lunar month (between new moons). The beginning of the Year 1 is taken to have occurred on a Sunday night, at 5 hours and 204 parts (counting hours from sunset. That's actually before Creation: 12 months later the new moon was at 8am on Friday, the day Adam and Eve are considered to have been created.

Anyway, you add 12 months of 29:12:793 (days:minutes:parts) each, or 13 for each leap year. Specifically, there are 7 leap years for every 19 years. So for each cycle of 19 years, the time and day-of-the-week of the new moon moves by 2 days, 16 hours, and 595 parts. Whatever.

So now you know when the new moon beginning a given year is, and also where in the 19-year cycle of leap-years it is, and thus whether or not it's a leap year. Leap years do not happen every four years: they happen in years 3, 6, 8, 11, 14, 17, and 19 of the 19-year cycle, which is rather more frequently. You may have to change the day of the New Year (Rosh Hashanah), though. If nothing interferes, it happens on the day of the new moon you just calculated. But more often than not, something changes it:

  1. If the moment of the new moon is after midday (halfway between sunrise and sunset), delay to the next day.
  2. If it's on Sunday, Wednesday, or Friday, either because it fell out there or was delayed, delay it again. Rosh Hashanah can not, under any circumstances, be on a Sunday, Wednesday, or Friday (well, the first day; the second day of course may wind up there).
  3. If it's after 9 hours and 204 parts on Tuesday (counting from sunset, remember!), in a non-leap year, delay it. This prevents some interactions that would result in an unacceptable year-length.
  4. If it's after 15 hours and 789 parts (from sunset!) on a Monday, for a non-leap year following a leap year, delay it.

OK! So this gives us a year-length of 353, 354, or 355 days in a non-leap year, and 383, 384, or 385 days in a leap year, or an average length of about 365.2428 days. A trifle long, I think, but quite close.

And then the months proceed as mentioned above; the month of Adar is repeated if it's a leap year. Technically, it's the first month of Adar that's the added one: Adar II, the second one, is considered the real month. The holiday of Purim, which falls in Adar, happens in Adar II, not Adar I, and birthdays and death-anniversaries are kept in Adar II, etc. The months are 29 or 30 days long, on a fixed schedule, with the months of Kislev and Heshvan being variable between the two, to accomodate the varying year-lengths (only three of the four combinations are possible: they're either both long, both short, or Heshvan is short and Kislev long).