Evanescent Wave Refraction I recently learned that a beam of light that undergoes total internal reflection leads to the formation of an evanescent surface wave on the reflection surface. What happens if this wave encounters a material with a higher or lower refractive index (the edge of the prism for example)? Will it refract? Can they, themselves undergo total internal reflection?

 A: evanescent wave actually is not a wave! because it has not an EM oscillating nature. it is a decay of energy.
and in certain circumstances can change to oscillating wave and propagates in the medium.

most of the waveguide, ring resonator, and fibers couplers use evanescent to the oscillating wave mechanism.
A: Evanescent waves can indeed refract and undergo total internal reflection, but your depiction isn't accurate. The evanescent wave is only present in the areas where there is a bona fide propagating wave on the other side of the boundary, so if you have a pencil-like beam with a limited impact area, the evanescent wave will be localized to that area. Similarly, for the evanescent wave to refract along the blue path in your diagram, you would need the entire prism to be filled with light performing total internal reflection, and while doing so refracting at the other boundary as shown by the blue path. 
The considerations in my answer to Does light reflect if incident at exactly the critical angle? may help understand this better. 
