The phenomenon that is needed to understand this question is Scattering of light. During sunset, the Sun is near the horizon. Horizon is the place where the sky and earth appear to meet. Near the horizon, the blue light and other shorter wavelengths are scattered by the particles present in atmosphere. But the red light has a long wavelength so it reaches our eyes. This gives rise to the reddish appearance of the Sun.