This works great, most of the time. But the eye can be fooled. Specifically, if the rays of light are diverted between the object and the eye, made to change direction, than the eye will deduce that they came from a completely different location, and see an object where there is no object at all. What the eye sees is an image of the object that created those rays. This is an optical illusion of the basest sort, so fundamental that we don't even think of it as a trick.
For instance, suppose a light is placed in a cup of water. When its rays reach the surface of the water and enter the air, they are refracted away from the normal. When an eyeball sees those rays, it will trace them back to an image that is closer to the surface than the object is. This is why swimming pools look shallower than they really are, and you can try it yourself with a penny in a cup of water.
Images you see in a mirror are created in a similar way. When an object is placed in front of a plane mirror (that is, one that isn't curved), rays of light from the object are reflected backwards according to the law of reflection. When the eye traces those rays backward, they appear to become from a point behind the mirror: a rather bizarre conclusion, but one we take for granted.