This is given by experiment: Snell’s Law of refraction:
sin theta = n1 sin theta1
In Snell’s Law n1 is the real refractive index, because sin theta and sin theta1 are real valued. The other part of Snell’s Law is Snell’s Law of reflection:
theta = theta2
meaning that the angle of incidence is equal to the angle of reflection.