It's quite easy. Place the safety in the on safe position. Looking at the bottom of the slide, you'll see a flat recess on the safety shaft on the side opposite of the lever. Use a flat blade screwdriver there to push the shaft out towards the lever side. It will move a bit and then stop. At this point move the safety lever to halfway between on and off safe, then push it the rest of the way out. There is a spring and pin which will fly out once the safety lever is removed. Place your hand over the slide when the shaft is just about to come out to catch them.
Once everything is apart check for any burrs or rough areas that might be causing the safety to bind. Sometimes the safety is so stiff from these the lever breaks off. Make sure the spring and pin can move freely in the hole as well. Clean everything throughly and lightly oil everything while you have access.
Place the spring and pin in the hole and hold them in place while you start to insert the new safety lever. Just push the lever the rest of the way in, then flip it on and off to make sure everything is seated correctly.