Thin-film interference occurs when light waves reflect off the top and bottom surfaces of a thin layer (like the oil film), and these reflected waves interfere with each other, producing constructive or destructive interference depending on the wavelength of light, the thickness of the film, and the angle of incidence.