When the sub rises and sets, the view is very beautiful. At such times the sky also appears to be changing colour rapidly . 

Sunlight passes through different layers of air. 

 While passing through these layers, light changes direction and also get divided. 

When sunlight passes through this upper layer, blue wavelengths are split and these rays can not travel vary far. 

While orange and red rays travel longer distances. In such a situation the colour of the sky appears red.