"Stop Lily an' James Potter' s son goin' ter Hogwarts! Yer mad. His name's been down ever since he was born. He's off ter the finest school of witchcraft and wizardry in the world."
-- Hagrid (PS4)
A magical quill at Hogwarts detects the birth of each magical child, then writes his or her name down in a large parchment tome bound with dragon hide, known as the Book of Admittance. Both are kept in a locked tower away from students at Howarts. Every year Professor McGonagall checks the book, then uses this information to send out owls to these children as they approach their eleventh birthdays (Sch1, Pm). The quill is made from a “faded” Augurey feather and no one can explain how it works: Augurey feathers usually repel ink, and there is none in the ink pot. Therefore, the silver fluid in the Quill is an unknown magical substance (Pm).
The Quill begins to write when it detects a “mere whiff of magic” from a newborn witch or wizard. The Book of Admittance, is much more picky and will slam shut if a child is not magical enough (Pm). If a child develops magical ability any time before the age of eleven, there name will be written down then
Hagrid told Harry that his name had been been "down" on the list since he was born (PS4).
Neville Longbottom, born just a day before Harry on July 30th, had a harder time proving his magical skill. It was only when his Uncle Algie tossed him out the window at the age of 8 and he survived the fall that the Book would allow the Quill to write his name down for Hogwarts (PS7,Pm).
The Quill of Acceptance and Book of Admittance are "sentient" magical items, similar to the Elder Wand, which can "choose" its true master even if separated by distance. The Quill and the Book can "see" when a baby is born, and "feel" whether he or she has magical ability. Dumbledore believed it was good for the school that the Book got the last word, especially when families were upset about having a Squib who couldn't attend Hogwarts (Pm).