Why do spiders make their web near the ceiling and near a light source?
Because many insects (their food) are attracted to light. This attraction is called phototaxis. 

Hypotheses for why insects are attracted to light


The leading hypothesis for why so many insects are attracted to light is that before artificial existed, insects were using the light from the moon in order to navigate. They would keep themselves at a given angle relative to the light source in order to navigate straight.
Another hypothesis is the presence of light indicates that the pathway is clear.
A third hypothesis is that some insects may confuse artificial light source with the other sex. This appeared to be true for moths for example


These three hypotheses are not mutually exclusive.

How do spiders chose their habitats

For more information about the abilities of spiders to find a good habitat, have a look at this very interesting answer.