In order to understand how an objects distance from the light source effects its shadow, lets first talk about what causes a shadow. A shadow is caused when an object lies in-between a light source and the background on which the light is landing. The object blocks a portion of light from the light source from making it to the final point on the background object, leading to a shadow.
To understand how the shadow is effected by the objects distance from the light source one must use principals of geometry. Thinking about it in this way, one can realize that the closer an object is to the source of light, the larger the shadow it casts. This is because the closer an object is to the light source, the greater area of the light the object will block, increasing shadow size. Alternatively, the further an object is located from the light source the less area it will block, leading to a smaller shadow being cast.
Another factor in shadow length is angle of the light source. The closer to horizontal the angle is relative to the object casting the shadow, the longer the shadow will be. Oppositely, the closer the light source is to completely vertical, relative to the object, the smaller the shadow will be cast. Hope this helps!