First you have to get the right size heatsink for the intended processor and a nice fan that will fit on it. It mainly screws into the heatsink fins making a snug fit.
If all you plan to do it to replace the fan, I wouldn't even bother taking the CPU out of its socket. Just take the old fan off and screw in the new one. If you plan on removing the heatsink, that's a bit more work.