The BEST explanation for why rainbows only appear when there is rain and sun is:
The combination of light and water creates a prismatic effect.
This is because rainbows are formed when sunlight is refracted, reflected, and dispersed in water droplets, resulting in a spectrum of light being visible.