Blue skies & warm sunsets
Air molecules scatter blue light more strongly than red. This is Rayleigh scattering. Blue light reaches you from across the sky; near sunset, a longer path through air scatters more blue out of the direct beam, leaving warmer sunlight. Red scatters too, just less strongly.
Light after sunset
Even when the Sun is below your horizon, it still lights the atmosphere above you. That air scatters sunlight toward you, giving us twilight. As the Sun sinks farther, Earth’s shadow covers more of the atmosphere and the sky darkens. Near the horizon, refraction also bends direct sunlight, briefly letting you see the Sun even when it is geometrically below the horizon.