This is essentially an E&M question, and so you sho […]
This is essentially an E&M question, and so you should be looking in Jackson (physics graduate text). Most of the effects can be explained in terms of dielectrics or conductors. This is very difficult, takes the better part of a quarter, and is impossible to explain here for all cases.China Transparent Quartz Glass Manufacturers
There are many different ways to think about this problem, depending on which regime you're in. You really do just have to take a graduate-level E&M class if you want all the specifics, but you can think about it from relatively simple models in some scenarios.
Dielectrics: Materials have electrons. In the simplest case, just think of an electron and its nucleus. The electron can be pulled to one side, giving a dipole field. If the electron oscillates back and forth, this is an oscillating dipole. Oscillating dipoles radiate. But if you think about it, the dipole will have some characteristic or resonant frequency. In reality, there are many different resonances. But there are also damping forces that can occur for lots of different reasons. You can now see how light can be transmitted - without this damping force, the light would just keep being transmitted from dipole to dipole in the material. But the damping force can drain energy out of the light, and little will be transmitted after a certain distance which depends on the damping force, the space between the conductors, etc., etc. Different resonances can also cause different frequencies to move at different speeds. This is how prisms work - different colors move at different speeds in the prism, and so at different angles when they enter and leave.
Conductors: Conductors have free electrons. These are usually what we think of when we say "metal". Free electrons can move very quickly, and so when they're hit by light, they can move to exactly cancel out the fields. They don't actually do it perfectly, there's an effect called "skin depth". This does vary with materials and frequencies, but in general, higher frequencies have a shorter skin depth. If you somehow get a very thin layer of metal, you will be able to see through it thanks to this skin depth.
In reality, when you look at the math, these are just two regimes in a continuum. Conductors and dielectrics use the same equations, but have different approximations. Plasmas fit in here too.
So you can see the answer depends very much on the configuration of electrons in the material, how they're bound, what their resonances are, etc., etc. There are even some metamaterials that have strange properties like effective negative indices of refraction due to the way the electrons are allowed to move in them.
This is just assuming that the materials act classically. There are even more complex things that can happen. Light can sometimes be absorbed chemically. Dipoles, if arranged properly and spaced correctly, can radiate so that light is canceled or reinforced (interference). Boundaries have separate problems. In extreme cases, more amazing physics can happen. Photons can pair-produce. Compton scattering, Raman scattering, and more can happen. Light is literally responsible for almost all of our interactions with the world.