Now, as for the nut... Nuts shouldn't need to be replaced very often. Many guitars will never have a nut replacement the entire time they exist... but guitars that get a lot of playing over long periods will need nut replacements at some point. Its a fairly simple procedure...
First, you have to select a nut that fits your string spacing... i recommend getting a pre-slotted nut... slotting a nut is the hardest part of electric guitar repair in my mind... Pick what material you would like as well... I recommend Bone or graphtech (graphite) they last a long time and sound good.
Next you have to remove the existing nut... I recommend not taking the strings off... just simply detune them waaaaaaay down and tape them together and tape them off to the side... this will save you time... Then you have to remove the nut... I do this by taking a small hand saw and sawing down the middle of the nut lengthwise (perpendicular to the way the strings sit in the nut). Saw until you get close to the bottom... but not quite... Next take a pair of pliers and squeeze the two seperate ends of the nut together and it should break the nut lose and you can simply pull it out!!!
Last thing you have to glue the nut down... get a high strength epoxy... i'm not sure what kind I've used in the past... I've used different kinds... Glue the nut in place... and try to get the strings placed in the nut slots and straighten the nut to your liking as fast as you can so the epoxy doesn't dry... If you elected to go with a pre-slotted blank nut... which has the slots started but not finished... or a blank nut... you will need to slot them and for that I would recommend you pick up Dan Earlewines Guitar Players Repair Guide... he will tell you all about slotting nuts in the book... its a lot to type out and I've already set my own personal record for longest post.... so have fun with that and I hope this helps!