Question: Why does oil on top of water create a rainbow effect?

Good question, and it involves some nice physics. Basically the oil forms a very thin layer (or film) on top of the water – of the order of a few wavelengths of light. At the boundary between the air and oil, and the boundary between the oil and water, a fraction of the light is reflected back and forth. For light that can fit a whole number n of wavelengths in the film, the light that is reflected on the lower layer and comes back out undergoes constructive interference with the light reflected from the upper layer (they reinforce one another). For light that fits (n + 1/2) wavelengths – you get destructive interference – it gets “cancelled out.” So you only see certain colours coming back, that looks a bit like a rainbow.

If you want to learn more, it is called “thin film interference” – you also can see it in soap bubbles.