This month will be to you the head of months; it will be the first of the months of the year. (Exodus 12:2)
Ask just about anyone and they’ll tell you that Judaism follows a lunar calendar. Just about anyone is wrong. The Jewish calendar is a combination of lunar and solar called, appropriately enough, lunisolar. The solar aspect is, for example, why the phrase “v’sein tal u’matar livracha” is inserted in Shemoneh Esrei starting on December 4th regardless of the Hebrew date. It likewise affects things from the insertion of the second Adar in leap years to the recitation of the birkat hachama every 28 years. But day to day Jewish life is more directly impacted by the lunar aspects of the calendar.
In parshas Bo, Exodus 12:2, God tells Moshe to establish the month of Nisan as the first month of the Jewish calendar. (This is why Rosh Hashana, the “Jewish New Year” falls in the seventh month. That’s only counter-intuitive when one is working from preconceptions based upon the Gregorian calendar.) The nation was commanded to declare the new month when witnesses reported the renewal of the moon. (If the moon was not witnessed by a certain point, the new month would be declared based on calculations.) The declaration of the months would ensure that the holidays would be observed at their proper times; the insertion of the leap month was also a component of this. (For example, Passover must fall in the spring. Without the leap month, Nisan would work its way around the seasons the way Ramadan does.)
This mitzvah was incumbent upon the court before we lost the original ordination that lasted from Moshe through the time of the Sanhedrin. Since then, we rely upon a cycle calculated by Rav Hillel HaNasi (AKA “Hillel II,” the son of Rav Yehuda HaNasi). This cycle tells us when the months start and when the leap months must be inserted in perpetuity until the Moshiach arrives.
Details of this law, including the examination of the witnesses and the rules for inserting the leap months, can be found in the Talmudic tractate of Rosh Hashana starting on page 18a. See also Talmud Sanhedrin 10b and Brachos 63a. This mitzvah is discussed in the Mishneh Torah in Hilchos Kiddush HaChodesh and is #153 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.