Light rays travel in straight lines from a light source. If an opaque object blocks these rays, a shadow is formed where the light cannot reach. Moving the light source closer to an object causes it to block more light, resulting in a larger shadow, while moving it farther away blocks less light and produces a smaller shadow.