The Torah explicitly writes that a Berit Mila should be performed on the eighth day since a child's birth (Bereishit 17:12, Vayikra 12:3). Even if a child is born on Shabbat, the circumcision is held on the eighth day, the following Shabbat.
Halacha defines "birth" with respect to this Halacha as the moment when the infant's head leaves the birth canal (Y’D, siman 262:4.) Nurses in hospitals generally record as the time of birth the moment when the infant's entire body exits the mother, which occasionally takes place some time after the emergence of the head. When a woman delivers a child close to sunset, she and her husband must make a point of noting the time when the head exits the mother's body, so that they can determine the day on which the child was born. Since a "day" with regard to this Halacha begins and ends at sunset, whether a baby is born before or after sunset will determine the day on which the Berit Mila should be performed. Parents must therefore ensure to take note of the precise time at which the infant's head exits the birth canal.
If the father prays Arbit before sundown, as many people do on Erev Shabbat during the summer months, the Halachic "day" nevertheless continues until sundown with respect to scheduling his child's Berit. For example, if a father recites Arbit at 7:30 PM on a Friday on which the sun sets at 8:30 PM, and his baby is born after he recited Arbit but before sundown, Friday would be considered the child's first day. The Berit would therefore be performed the following Friday, and not the following Shabbat. Even though the father had already recited Arbit, we do not consider a new day to have begun until sundown. (See Sova Semahot, Helek 2, page 174.)
The Halachic term "Bein Ha'shemashot" refers to the period between sundown and nightfall, a period whose status as day or night is uncertain. If a child is born during "Bein Ha'shemashot" late Friday afternoon, his Berit Mila is delayed until Sunday of the next week (nine days later). The Berit cannot be performed on Friday, because the birth may have occurred on Shabbat, in which case Friday is only the seventh day. The Berit cannot be held on Shabbat, either, because if the birth took place on Friday, then Shabbat is the ninth, rather than the eighth, day, and a circumcision is performed on Shabbat only if Shabbat is the eighth day. Therefore, when a child is born during Bein Ha'shemashot on Friday afternoon, the Berit Mila is not performed until two Sundays later. (See Y’D, siman 266:8)
There is considerable controversy as to how long after sundown the period of "Bein Ha'shemashot" extends. Many different views exist in this regard, and therefore in situations when a child is born shortly after sundown, a competent Halachic authority must be consulted for guidance. (See Yabia Omer, Helek 7, O”H, siman 41.)
Summary: A Berit Mila should be performed on a child's eighth day, even on Shabbat. Halacha considers the child's first day the day on which his head exited the birth canal. Thus, if a child's head emerges before sundown and the rest of the body emerges after sundown, the birth is considered to have occurred on the first day. If a father recited Arbit before sundown, the next day nevertheless begins only after sundown. If a child is born shortly after sundown on Friday afternoon, during the period of "Bein Ha'shemashot," the circumcision is delayed until two Sundays later. Many different views exist as to the duration of "Bein Ha'shemashot," and therefore in all such situations one must consult a Rabbi for guidance.