The earliest references to this custom of Wach-nacht are from sixteenth century Germany, but it seems it was practiced centuries before . Before a bris is performed, the baby and the mother are susceptible to harm from evil spirits. This is especially acute for the baby on the night before the bris, hence the prayer and/or study vigil around his bed. In early times, candles were lit and food was put out on a table to placate these destructive spirits. After the bris the danger dissipates as the child is a full fledged Jew and has the same spritual protection as anyone else. Also explains why for a female this is unncessary, she is full fledged from birth.