You’ve seen rays of light shine through a cloud. It’s pretty easy to guess that the thicker parts of the clouds block sunlight while the thinner parts let it shine through. In fact, when clouds have complete holes in them, or breaks in between them, we often see beams of light that seem to fan out from the sun. Those are commonly called crepuscular rays.
The American Meteorological Society defines crepuscular rays as “(shadow bands.) Literally “twilight rays,” these alternating dark and light bands (shadows and light scattered from sunbeams, respectively) seem to diverge fanlike from the sun’s position during twilight.”
We see sunlight in the sky because we have water vapor, dust, and other elements and particles in the atmosphere that scatter the light. On the moon where there is no atmosphere, the sky is always black.
When the sky is clear overhead, and the sun is low in the sky with distant clouds partially or totally in front of it, those clouds can cast shadows through the particles in the sky. Sometimes those clouds are so far away that you can’t see them and that is very common from tops of tall thunderstorms at sunset.
The shadows that they create, like the beams of light in crepuscular rays, are actually parallel, but perspective makes it seem that they are fanning out from the distant sun. When you look in the opposite direction, you’ll see that they often seem to converge in the distance. Those are called anti-crepuscular rays, and they are also parallel. It’s the same effect you get when you look down a row of crops, or down train tracks.
Even when the sun is below the horizon, for many minutes after sunset (or before sunrise), the rays of light still directly illuminate the sky, as they point more upward. This is why clouds can be bright before sunrise, and after sunset. It’s also why you see those shadows in the clear sky that go upward, not downward.