The obligation of fasting the month of Ramadan becomes incumbent upon the occurrence of one of two matters: to sight the crescent of Ramadan after the sunset of the 29th day of Sha^ban (the month directly preceding Ramadan) or, if the crescent is not seen, then completing thirty (30) days of Sha^ban. So, the beginning of the month of Ramadan, as well as the end of the month, is determined by sighting the crescent. If the crescent is not sighted, then the month would be completed by 30 days–as is the case with determining all the months of the lunar calendar. This is taken from the hadith of the Prophet related by al-Bukhariyy and Muslim:
لا تقدموا رمضان بيوم أو يومين صوموا لرؤيته و أفطروا لرؤيته فإن غم عليكم فأكملوا عدة شعبان ثلاثين
This means: <<Do not fast one or two days before Ramadan. Start the month when you see the crescent and end the month when you see the crescent. If you are blocked from seeing it, complete thirty days of Sha^ban.>>
So, on the 29th day of Sha^ban, directly after the sun sets, the Muslims look towards the western horizon. If the crescent (of the new moon) is seen, the following day will be the first day of Ramadan. If it is not seen, because of cloud cover or another reason, then the next day will complete thirty (30) days of Sha^ban, and the day after that is the first day of Ramadan.
The judge confirms the beginning of Ramadan if one upright Muslim, whose testimony is acceptable to the judge, bears witness he saw the crescent. Several conditions must be met for a person’s testimony to be acceptable to the judge in this matter. He must be Muslim, male, pubescent, free, clear of enormous sins, clear of having his small sins exceed his acts of obedience, and one who abides by the ethics and manners of the people of his class.
So if a person who did not satisfy these conditions testified to the judge that he saw the crescent, like, for example: a woman, a child, one who commits enormous sins, or a slave, then the judge would not confirm the beginning of the month of Ramadan and would not announce to the general public to commence fasting–relying solely upon their testimony.
However, if just one upright Muslim, who has satisfied the aforementioned conditions testified to the judge he saw the crescent, the judge would confirm the beginning of Ramadan for the next day. This is known from the hadith related by Abu Dawud from the route of ^Abdullah Ibn ^Umar. ^Abdullah Ibn ^Umar told the Prophet he had sighted the crescent, so the Prophet fasted the next day and ordered the others to fast as well.
Be warned of those who determine the month of Ramadan relying upon astronomical calculations. Prophet Muhammad peace to be upon him informed us that such calculations are not relied upon in determining such matters. Imam Ahmad related in his Musnad that the Prophet said:
إنَّا أُمَّةٌ أُمّـِيَّةٌ لا نكتُب ولا نَحْسُبُ، الشهرُ هكذا وهكذا
Which means: <<We are a nation which does not depend on writings and calculations [to determine the beginning of the month]. The month is either twenty-nine or thirty days.>>
Praise be to Allah, how easy the matter is! Any Muslim with sound sight can observe the crescent. He does not need to rely on complex calculations which only a few people understand.