Digicams can be equipped with two kinds of autofocus. Active autofocus cameras emit an infrared beam which is reflected by the subject so the camera can focus on it. Infrared instead of visible light is ideal for "candid" shots as the subject will not be aware of the camera focusing on them. Though infrared autofocus works in the dark, the beam might be absorbed by a black subject, or bounced back by something in front of the subject such as a window.
Passive autofocus can lock on to your subject when there is light and contrast. Especially vertical lines work well for these systems. If there is little or no contrast or no vertical lines in your subject, the camera will emit a beam of light that projects a grid onto the subject for the camera to focus on.
This auto focus assist light is usually located beside or above the lens barrel. A disadvantage is that it only works up to about 4 or 5 meters. Some dedicated portable flashguns are fitted with an auto focus assist lamp that emits a stronger light to focus on subjects farther away.
In certain cameras this focus assist lamp will double up as an anti-red eye light. It emits a fairly strong beam of light that makes the eye's pupil contract to reduce red eye before the picture is being taken.