In Polynesian shallow water, the temperature difference from short place to place is so high that one can see the same trouble refraction that exist in air above fire or metal sheet in summer. So I'm curious: could mirages form under water? OK, one condition for this to happen would be that the temperature (and temperature gradient) should be very well stratified, I guess. Which other conditions?
Caveat: I am attempting to answer the question "what conditions would be needed". I am not stating that this does occur in practice, although thermal inversion layers are very real, and the acoustic mismatch on the boundary can be sufficient to "hide" a submarine from sonar (the acoustic equivalent of a mirage)
Thermal inversion layers do occur underwater, and they result in a (small) mismatch in density and an even smaller mismatch in refractive index; in principle these would allow for reflections to occur. The water has to be very still - you need a nice flat interface, and any currents or turbulence will disturb it and prevent the appearance of a "good" reflection.
Obviously, whether you see a reflection also depends on the change in refractive index across the interface. This directly relates to the change in density.
The density of water changes by a small amount with temperature: according to this link it behaves like this:
which shows about a 0.2% change in density for a 20 °C change in temperature. The refractive index changes by even less. According to Table 1 in this paper there is only a 0.1% change in refractive index over 20 degree temperature shift:
That is a pretty small change in refractive index - so you need to be viewing at just the right angle in order to get reflection, and the inversion layer would have to be undisturbed by currents. Note that total internal reflection happens when you go from higher to lower refractive index - meaning you are more likely to see the effect if you are in the colder water, and looking at the warmer water (at a sufficiently glancing angle of incidence).
So while it is theoretically possible, I would say it is extremely unlikely you could observe this "in the wild"; it might be possible to set up the experiment under carefully controlled lab conditions.
I did find a reference to an observed "underwater mirage" at https://en.m.wikipedia.org/wiki/Thermocline
When scuba diving, a thermocline where water drops in temperature by a few degrees Celsius quite suddenly can sometimes be observed between two bodies of water, for example where colder upwelling water runs into a surface layer of warmer water. It gives the water an appearance of wrinkled glass that is often used to obscure bathroom windows and is caused by the altered refractive index of the cold or warm water column. These same schlieren can be observed when hot air rises off the tarmac at airports or desert roads and is the cause of mirages.
Mirages do occur underwater, but their most obvious incarnations are sound-based rather than light-based. The most common case is where the surface water is warmer and less dense than the deeper water, just as the air on the surface of the desert is warmer and less dense than the air at greater altitudes. Underwater, this bends sound traveling parallel to the surface downwards, just as air mirages bend light upwards.
Submarines using passive or active sonar must contend with these thermoclines gradients which bend and even reflect sound waves. Other submarines can hide under thermoclines because the sounds emitted upwards by the submarine will be bent back down by the transition to warmer, less dense water.
I believe that you could have light mirages underwater due to these same thermoclines, but my guess is that they'd have to involve great distances, and so would only be perceivable in extremely clear water.