One versus two days of Rosh Chodesh:
A. Why in some months do we celebrate Rosh Chodesh two days and in some months only one?
Above we explained why there are months which contain 29 days and months that contain 30 days. This however does not explain why we celebrate Rosh Chodesh for two days in months in which there are thirty days. In a 29 day month, Rosh Chodesh is celebrated on the 30th day, which is counted as the first of the next month. In a thirty day month, Rosh Chodesh is celebrated on both the 30th day of that month and also on the next day, which is the first of the new month. Thus, it ends up that the 30th day is always Rosh Chodesh whether it is Malei or Chaseir month. Now, why is Rosh Chodesh celebrated on the 30th day of a Malei month if it is not the first of the next month? There are two approaches to answering this question:
First approach: The Rambam and other Rishonim explains as follows: The moon’s cycle of orbit in making a 360 degree circle around the earth takes slightly more than 29.5 days. Thus, the moon finishes its orbit on the 30th day, whether it is a 29 day month or a thirty day month. For this reason the 30th day is always celebrated as Rosh Chodesh, whether the month contains 30 days or 29 days. In a month that the 31st day is the first day of the next month, then one celebrates Rosh Chodesh on both the 30th and the 31st day.
Second approach: Some question the above approach being that in today’s calendar we clearly see that there are days in which the Molad does not fall on the 30th day, but rather on the 28th or 29th day [see chart in previous Halacha], and hence why should the 30th day be Rosh Chodesh? They therefore answer that the reason we celebrate Rosh Chodesh on the 30th and 31st day is because of Sfeika Deyoma. Meaning, that since in the times of the Temple they always celebrated the 30th day as Rosh Chodesh being that they anticipated the arrival of witnesses, therefore also today we celebrate Rosh Chodesh also on the 30th day, even though we know that Rosh Chodesh will only begin on the 31st day.
B. When did we begin keeping two days of Rosh Chodesh?
It is disputed as to whether two days of Rosh Chodesh in 30 day months was also celebrated in times when the moon was sanctified based on testimony, or if this only began once the testimony was abolished and the calendar was created. Some Poskim write that two days of Rosh Chodesh were celebrated whenever the month was full [30 days], even during the times that the moon was sanctified based on testimony. Some record that even during the times of Moshe Rabbeinu there were some months in which we celebrated two days of Rosh Chodesh. Other Poskim however write that the celebration of a two day Rosh Chodesh only began once the calendar was created, after sanctification based on sight of the moon was nullified.
 See Torah Sheleima ibid p. 115
 Rambam; Kiddush Hachodesh 8/4; Tur 427
 Rambam Kiddush Hachodesh 8/4; Shivlei Haleket Inyan Rosh Chodesh in name of Rabbeinu Shlomo
 Rambam Kiddush Hachodesh 8/4
 Shivlei Haleket Inyan Rosh Chodesh in name of Rabbeinu Shlomo; Tur 427
 Nachal Eden p. 48; See Torah Sheleima ibid; M”B 422/3 states that the two days of Rosh Chodesh is due to Sfeika Deyoma
 Nachal Eden p. 48; See Torah Sheleima ibid
 See Moadim Behalacha [Zevin] p. 134
 Tashbatz 1/153; Shivlei Haleket 168
Opinion of Rambam: See Rambam Kiddush Hachodesh 8/4 which rules that the 30th of a month is always Rosh Chodesh, whether the month is Malei or Chaseir. However perhaps this only refers to the times that we sanctify based on the calendar calculation and not based on witnesses. See also Rambam ibid 3/7 that implies that in times in which the moon was sanctified based on testimony, only the 31st day was made into Rosh Chodesh by a Chodesh Malei [Meubar].
 See Taanis 29a; Rashi on Iyun Yaakov; Moadim Behalacha p. 134; However see Rabbeinu Bechayeh Bo that throughout the 40 years in the desert, we did not sanctify the moon based on sight, as the clouds blocked the moon’s visibility.
 Rashi Baba Metzia 59b [That Rebbe Eliezer said Tachanun on the 30th because his wife thought Rosh Chodesh would only be on the 31st]; Shiltei Giborim Rosh Hashanah 1