Compton scattering is interesting as to completely explain the effect requires quantum physics and relativity. When Arthur Holly Compton first conducted his experiments into this effect in 1923 at Washington University, St. Louis relativity and quantum physics in particular were fairly new theories, perhaps not completely accepted... The experiment's carried out by Compton however proved that light must be quantised and exist as 'particles' called photons.
A diagram of the apparatus he used is shown below :-

                            |      |  
                              / Scattered X-Rays
       ||  ||  ||            /
       ||  ||  ||        ***/
       ||  ||  ||        ***
       ||  ||  ||     Graphite
      Collimating      Target

The X-ray beam hits the graphite target, electrons in the sample scatter the the photons in all directions. Both the intensity and the wavelength of these x-rays are measured at various angles.

The results he obtained were that the scattered x-rays had two different wavelengths and different intensities. Shown below is a diagram of the result for an angle of 135o, relative to the incident beam. You can see that the wavelength of the x-ray has been shifted upwards by about 5 pico meters. In fact Compton found, the larger the scattering angle, the larger the shift in frequency.
         For phi (scattering angle) = 135o
 I|              :         
 N|              :
 T|     :       : :
 E|     :       :  :
 N|    : :     :   :
 S|    : :     :    :
 I|    : :    :     :
 T|   :   :   :     :
 Y| ..:   :..:       :..
       70        75 
     Wavelength in Pico-meters 

This result cannot be explained if the x-ray is treated as a wave; if you did, then the wave would hit the electrons, causing them to oscillate at the frequency of the beam. The electrons would act like an antenna and radiate the energy they absorbed from the beam at the same frequency as the incident beam.
If you treat (as Compton did) the x-rays and electrons as being particles, then they interact through collisons, the scattering being like snooker balls colliding at various angles. As the electron therefore picks up kinetic energy from the photon, the photon must loose kinetic energy and therefore must in turn have a longer wavelength. Which is of course exactly what he observed....

To model the system accurately, you have to take relativity into account as the electrons may be hit so hard they are accelerated to near the speed of light.

Now comes the maths of the derivation of the final equation...
Using the principle of the conservation of energy the system consists of three components, the incoming xray radiation, (energy hf), the outgoing xray radiation, (hf') and the electron which has the energy given by the term on the right, after the '+'.

hf=hf' + mc2(1/sqrt(1-(v/c)2) -1)

Where h is Plank's constant, f the frequency, m the mass of the electron, v the velocity of the electron and c the speed of light.

You can subsitute c/lambda for hf (lambda being the wavelength of the photons), which gives :-

h/lambda=h/lambda' + mc2(1 /sqrt(1-(v/c)2) -1)

The momentum, p of the electron is given by :- p = mv/sqrt(1-(v/c)2)

Now the collision of the photon with the electron looks a bit like this :-

         y    Photon (lambda')
         |   /
         |  / ^
         | /  :Angle phi
         |/   v
~~~~~~~~>*--------- x
 Photon  |\   ^
(lambda) | \  :Angle PHI 
         |  \ v
         |   \
              * Electron

The electron is scattered off at angle PHI, and the photon with angle phi and wavelength lambda'. Using a vector based description of the conservation of momentum for this system gives :-

For the x component....

(h/lambda) = (h/lambda') cos phi+ mv/sqrt(1-(v/c)2) cos PHI

....and for the y component....

0 = (h/lambda') sin phi - mv/sqrt(1-(v/c)2) sin PHI

Because we are actually only interested in the photon, v and PHI which deal with the electron can be eliminated, which leads to the following expression for the Compton shift :-

delta lambda = --- (1 - cos phi)

If you examine the above equation you can see that the shift only depends on the scattering angle, and not on the energy of the incident photon. All the above depends of the electrons in the sample being 'free', that is able to be knocked out of the sample. If the electron is too tightly bound, then you're really trying to move not just the electron, but the whole carbon atom, which is 22,000 times heavier. This makes the Compton shift due to bound electons too small to see. Which explains why there is two peaks in the spectrum above, one due to free electrons, and one due to bound electrons.

The huge EMP pulse generated by a nuclear bomb, which can knock out electronic equipment is caused by the Compton effect. When the bomb denonates, radiation is generated across a huge range of frequencies, all the way up to gamma rays. The collisons between these high energy photons with electrons in the atmosphere cause a huge movement of charge, which in turn set up large electro-magnetic fields.