It depends on the type of shield, but a standard deflector shield generator works by creating a force field extending outwards from the surface of the projector, surrounding the vessel or other construction. (Often, this includes both ray and particle shielding, protecting from energy and solid objects respectively.) The shield then acts to diffuse the energy applied to it, kinetic and thermal, and re-radiate it back into the environment. Commonly, a ship’s shielding actually permeates the hull in a series of energy layers that extend out several centimeters. I know that’s not terribly specific, sorry, but the actual physics of the generator are not fully explained.
Hope that helps!
~ Jacen