Reflection and refraction are both phenomena associated with the behavior of light when it encounters a boundary between two different media.
Reflection occurs when light bounces off a surface and changes direction. It obeys the law of reflection, which states that the incident angle (the angle between the incident light ray and the normal to the surface) is equal to the angle of reflection (the angle between the reflected light ray and the normal to the surface). The incident light and the reflected light lie on the same plane. Reflection allows us to see objects in mirrors or any other shiny surfaces.
On the other hand, refraction occurs when light passes from one medium to another and changes direction due to the change in the speed of light. When light enters a different medium at an angle, it bends, or changes its direction, according to Snell's law. Snell's law relates the angle of incidence and the angle of refraction to the indices of refraction of the two media involved. Refraction is responsible for various optical phenomena, such as the bending of light in a glass prism or the apparent displacement of an object submerged in water.
Now, regarding your question about why light reflects from a flat surface but doesn't go in, it's because of the different optical properties of transparent materials (like glass) and opaque materials (like most solid surfaces). When light encounters a flat opaque surface, such as a wall or a table, the atoms and molecules in the surface absorb and scatter the incident light rather than allowing it to pass through. As a result, very little light enters the material, and most of it is reflected off the surface. This is why we see our reflection on a flat mirror.
In contrast, transparent materials have a different arrangement of atoms and molecules that allows light to pass through them. When light encounters a flat transparent surface, such as a window, a portion of the incident light is reflected, and another portion enters the material. However, even in transparent materials, some light is still reflected, but it may not be as noticeable as in opaque surfaces.
In summary, the behavior of light at a boundary depends on the optical properties of the material involved. Opaque surfaces reflect most of the incident light, while transparent surfaces allow some light to pass through, with a portion being reflected.