Hwlau is correct about the book but the answer actually isn't that long so I think I can try to mention some basic points.
Path integral
One approach to quantum theory called path integral tells you that you have to sum probability amplitudes (I'll assume that you have at least some idea of what probability amplitude is; QED can't really be explained without this minimal level of knowledge)) over all possible paths that the particle can take.
Now for photons probability amplitude of a given path is $\exp(i K L)$ where $K$ is some constant and $L$ is a length of the path (note that this is very simplified picture but I don't want to get too technical so this is fine for now). The basic point is that you can imagine that amplitude as a unit vector in the complex plane. So when doing a path integral you are adding lots of short arrows (this terminology is of course due to Feynman). In general for any given trajectory I can find many shorter and longer paths so this will give us a nonconstructive interference (you will be adding lots of arrows that point in random directions). But there can exist some special paths which are either longest or shortest (in other words, extremal) and these will give you constructive interference. This is called Fermat's principle.
Fermat's principle
So much for the preparation and now to answer your question. We will proceed in two steps. First we will give classical answer using Fermat's principle and then we will need to address other issues that will arise.
Let's illustrate this first on a problem of light traveling between points $A$ and $B$ in free space. You can find lots of paths between them but if it won't be the shortest one it won't actually contribute to the path integral for the reasons given above. The only one that will is the shortest one so this recovers the fact that light travels in straight lines. The same answer can be recovered for reflection. For refraction you will have to take into account that the constant $K$ mentioned above depends on the index of refraction (at least classically; we will explain how it arises from microscopic principles later). But again you can arrive at Snell's law using just Fermat's principle.
QED
Now to address actual microscopic questions.
First, index of refraction arises because light travels slower in materials.
And what about reflection? Well, we are actually getting to the roots of the QED so it's about time we introduced interactions. Amazingly, there is actually only one interaction: electron absorbs photon. This interaction again gets a probability amplitude and you have to take this into account when computing the path integral. So let's see what we can say about a photon that goes from $A$ then hits a mirror and then goes to $B$.
We already know that the photon travels in straight lines both between $A$ and the mirror and between mirror and $B$. What can happen in between? Well, the complete picture is of course complicated: photon can get absorbed by an electron then it will be re-emitted (note that even if we are talking about the photon here, the emitted photon is actually distinct from the original one; but it doesn't matter that much) then it can travel for some time inside the material get absorbed by another electron, re-emitted again and finally fly back to $B$.
To make the picture simpler we will just consider the case that the material is a 100% real mirror (if it were e.g. glass you would actually get multiple reflections from all of the layers inside the material, most of which would destructively interfere and you'd be left with reflections from front and back surface of the glass; obviously, I would have to make this already long answer twice longer :-)). For mirrors there is only one major contribution and that is that the photon gets scattered (absorbed and re-emitted) directly on the surface layer of electrons of the mirror and then flies back.
Quiz question: and what about process that the photon flies to the mirror and then changes its mind and flies back to $B$ without interacting with any electrons; this is surely a possible trajectory we have to take into account. Is this an important contribution to the path integral or not?
In classical electrodynamics, the process of how much light refracts, passing through the glass, and how much light reflects, is determined by the Huygens-Fresnel principle.
This principle, named after Christiaan Huygens and Augustin-Jean Fresnel, is a method of analyzing the wave propagation patterns of light, especially in diffraction and refraction. It states that every unobstructed point on a wave-front emanates secondary spherical waves in all directions. Hence, the net light amplitude at a given point is the vector sum of all wave amplitudes at that point. This principle makes it very useful in visualizing what happens during light diffraction.
Although, as Alex says in his answer, you can use the QFT approach, I would like to provide an alternative answer, using classical, (that is not quantum based) reasoning. It's just easier, for me anyway, to understand :), and, hopefully, to answer.
From Wikipedia: Fresnel Equations
In classical electrodynamics, light is considered as an electromagnetic wave, which is described by Maxwell's equations. Light waves incident on a material induce small oscillations of polarisation in the individual atoms (or oscillation of electrons, in metals), causing each particle to radiate a small secondary wave in all directions, like a dipole antenna. All these waves add up to give specular reflection and refraction, according to the Huygens–Fresnel principle.
In the case of dielectrics such as glass, the electric field of the light acts on the electrons in the material, and the moving electrons generate fields and become new radiators. The refracted light in the glass is the combination of the forward radiation of the electrons and the incident light. The reflected light is the combination of the backward radiation of all of the electrons
When light moves from a medium of a given refractive index n1 into a second medium with refractive index n2, both reflection and refraction of the light may occur. The Fresnel equations describe what fraction of the light is reflected and what fraction is refracted (i.e., transmitted). They also describe the phase shift of the reflected light.
The incident light is polarized with its electric field perpendicular to the plane containing the incident, reflected, and refracted rays. This plane is called the plane of incidence; it is the plane of the diagram below. The light is said to be s-polarized. The incident light is polarized with its electric field parallel to the plane of incidence. Such light is described as p-polarized.
![Snell's Law](https://i.stack.imgur.com/e7d7T.png)
An incident light ray IO strikes the interface between two media of refractive indices n1 and n2 at point O. Part of the ray is reflected as ray OR and part refracted as ray OT. The angles that the incident, reflected and refracted rays make to the normal of the interface are given as θi, θr and θt, respectively.
The relationship between these angles is given by the law of reflection and Snell's law:
The fraction of the incident power that is reflected from the interface is given by the reflectance or reflectivity R and the fraction that is refracted is given by the transmittance or transmissivity T (unrelated to the transmission through a medium).
If you can follow the math, mostly just trigonometry, you can get the proportion of light passing through the glass, and the proportion that reflects, here:
Refraction and Reflection Coefficients
It's not easy , for me at least, to immediately find an answer to your question based on QFT, as most of the QFT explanations seem to deal with mirrors and how they reflect light, rather than explain how some goes through the glass and some reflects, (as in your particular question), but a good explanation, which is basically a copy of Feymann's book, can be found here:
Light Reflection
Just a thought. Is this due to atoms of different substances like water,glass or wood etc curve spacetime differently and thus it influences how photons interact with matter? i.e. some photons reflect and some refract.
I would say no to that reasoning, spacetime is not curved enough in a plate of glass to have a significant effect.
Best Answer
First, there is a qualitative difference between metal and glass: metal is a conductor, while glass is a dielectric. Under so called "plasma frequency" EM waves do not travel in conductors except that near the surface (see skin effect). For higher frequencies (usually far above the visible light) metal is transparent and refraction does occur. Specifically, answering to your question
Metal has a substantial amount of free electrons, glass doesn't. From the EM point of view, the difference originates from the relative effect of two terms in the Maxwell equation (roughly speaking, the corresponding dimensionless parameter depends on conductivity and wave frequency). From the QM point of view, the interaction with electron gas is substantially different from the interaction with an atom.
Again, from the EM point of view both of these processes result in an evanescent wave and are quite similar. I am not sure what exactly happens with a specific photon (as a particle) here, as the evanescent wave is a general wave effect. Perhaps someone more knowledgeable in QED can provide a QM perspective on this.