Beitzah 5 - Why do we observe two days of Yom Tov?
Even though the appearance of the moon, and hence the beginning of the new month, was calculated by Sanhedrin, they would not announce it until witnesses testified that they saw the new moon. Once the official day beginning the month was known, all Holidays: Rosh Hashana, Yom Kippur, etc., were set.
The Jews in Diaspora, starting with Babylon, had to wait until the messengers of the Court would arrive and tell them about the new moon, and since it often took quite long, they celebrated two days of Holidays (Yom Tov), out of doubt. Only one day of the two was the real Holiday. Therefore, an egg laid on the first day was always permitted on the second. Here is why. Either the first day was a real Holiday, and then the second was a weekday, or the first was a weekday - and the egg laid then was permitted on the second day.
If so, then after the calendar was fixed by Hillel, the last Prince, in about eighth century - why do people still celebrate two days of Yom Tov? - Because the Sages living in the Land of Israel urged everybody to keep the custom. The fear was that some new government may forbid the study of Torah, the Sages of the Diaspora would forget how to calculate the calendar, and as a result eat leavened bread on Passover.
It could be though that on Rosh HaShana this reasoning about the egg does not apply, because of a series of complicated logical derivations.
Art: Moonrise over the Sea By Caspar David Friedrich