Here's an exploded view of a PP series pistol:
http://www.stevespages.com/ipb-walther-pp.html
The key parts here are 2, 3, 4, 5, and 36.
The Extractor spring part 4 puts tension on the safety plunger part 5.
The plunger contacts detents in the safety part 36 and both gives it the "snap" and retains it in the ON or OFF position.
Potential problems are a fouled spring tunnel in the slide, a rusty or fouled spring or detent, a detent with the tip worn off, or worn safety detent holes.
Disassembly of the PP series slide is a little difficult due to the strong springs.
Basic disassembly of the slide is as follows:
Use a small pocket size screwdriver with the sharp edges and corners rounded off to prevent gouging the slide.
Tape the slide around the extractor to protect it in case of a slip.
Using the screwdriver, pull the plunger behind the extractor to the rear as you lift the extractor up and out of the slide.
Remove the extractor plunger, the spring, and the safety plunger from the tunnel. Don't worry if they won't come out, they can be removed later.
Use a punch to push the firing pin into the slide, then rotate the safety to the half way position.
Wiggle and pull the safety until it comes out of the slide.
Ease the firing pin and spring out.
Don't remove the loaded chamber pin and spring unless necessary. If you do, pay attention to how the spring is positioned.
You can then use a pipe cleaner or wire to push the extractor plunger, the spring, and the safety plunder out the slide from the rear.
Clean the tunnel thoroughly, and inspect the pointed end of the safety plunger and the two detent holes in the safety for wear.
Inspect the spring for weakness, rust, or fouling.
To reassemble, reverse the above.
Make sure the bevel on the front of the extractor plunger is laying on the extractor when reassembling.