It's very simple..
http://www.youtube.com/watch?v=vLVHFaokdgA there's a video explaining how to do it for AMD processors, Intel ones arn't much different, only biggest difference is kinda the how the processor and socket looks like...
Just make sure what socket is on your motherboard (AM2, AM2+,AM3 for AMD.. LGA 776, LGA 1156, LGA 1366 etc.. for Intel)
Then you make sure you get a processor that fits in the socket (AM3 processors's will fit in AM2+ sockets)...
Then you just open the PC up and take out the cooler, make sure to clean off any thermal paste (the paste thingy) from both the old processor and the cooler (when you take out the processor, be sure to bend uo the little lever thingy next to the socket, NEVER force the processor to come out).. Most techies will recommend you to clean it off with alcohol for best effect, but using a simple cleaning cloth should work too.. also, be careful when handling with ANY processor, the small pins on the underside is VERY sensitive, and you dont want to bend or break them.. so avoid touching them at any cost... be careful too to not get too much paste on yourself since it can be very toxic and stuff...
And now it's time to install the new processor:
Just grab your new processor (making sure to not touch the pins and being very careful) look at the position of the little triangle on one of the edges and align it with the triangle on the socket and just simply drop it in (again, dont force it in, it should only go in in one way and if it's not going in by just putting in it carefully, your most likely doing something wrong)..
Then makes sure to add a new thin layer of thermal paste (you should be able to buy some at the nearest techy store) on top of the processor surface only and simply put the cooler back on... DONE!
Oh, on a side note.. make on your motherboard manufacturer's website that your motherboard (ask me if you need help finding which motherboard you have) supports the CPU you've chosen... If it does but you still can't get the PC working and you have done everything the right way, or if you get the PC working, but it can't identify what CPU you are using, you need to do a BIOS update, and again.. if you want more info on this, just ask.