The sun remains visible for some time after it actually sets below the horizon. This happens due to

dispersion

Scattering of light

atmosphere refraction

Persistence of vision