The main concept involved in the appearance of rainbow with red on top and violet on the bottom is dispersion.
Photons of sunlight comprises of different wavelengths. These wavelengths refract at the front surface of raindrop at different angles. Out of the seven colors of the light focused on the raindrop, red light possesses greatest wavelength and violet possesses lowest wavelength. So, the red light deviates most and violet deviates least.
When the light is incident on the rain drop, it gets reflected from the back surface of the drop and again gets refracted from the front end of the drop’s surface while leaving the drop. The two lights red and violet emerge outside from the raindrop with different angles. Since, red light deviates most relative to the incident angle, it reaches the observer and the drop appears as red. Similarly, because of least deviation, the violet light passes over the observer and violet color of the drop appears low in the sky. Thus, rainbow appears red on the top and violet on the bottom.