At the top (slab / air) interface, the ray is partially transmitted and partially reflected. The unpolarised Fresnel reflectance at angle θ inside the slab is
A random draw decides whether this particular ray transmits (counted as "escaped") or reflects (bounces back for another try). At the bottom mirror the ray always reflects — lossless by construction.
Why not just TIR
A pure TIR trace would count every ray inside the escape cone as fully transmitted and every ray outside as fully reflected. That ignores the ~3–20 % per-bounce Fresnel losses and gives an unrealistically high escape fraction. The full Fresnel accounting is what makes the Monte Carlo match the measured OLED-escape literature.