A mirage occurs because light travels through air layers of different temperatures and refractive indices. The bending becomes extreme and can lead to total internal reflection. Strictly speaking, atmospheric refraction is also part of the mechanism, so "total internal reflection only" is simplified textbook wording.