If your favorite lamp no longer comes on when you turn the switch, or comes on and then goes off again, you don't have to throw it out and buy a new one. You can fix a lamp switch easily. Every lamp switch either comes loose at some point during its lifetime or simply wears out. Fortunately, not only is fixing a lamp switch easy, but all you need are a few simple tools and possibly an inexpensive replacement switch as well.
Unplug the lamp. If the lamp has been on, let it sit for 15 to 20 minutes so the light bulb is cool to the touch. Once the bulb is cool, remove it.
Grab the metal light bulb holder and unscrew it from the switch casing by turning it counterclockwise. Set the metal holder aside.
Look at the switch. You will see that the power cord actually consists of two separate electrical wires that are attached to the switch by small brass screws. Reach in and see if you can wiggle either of the wires. If you can, tighten the screws with a small Phillips head, replace the metal bulb holder and bulb, plug the lamp in and test it. Often a faulty lamp switch is caused by the wires coming loose and does not need to be replaced. If the lamp does not work, repeat steps 1 and 2 to expose the switch again.
Grab the two wires near where they turn down into the body of the lamp and pull up. The electrical cord will be pulled up through the lamp. You will want 6" of the cord extending above the lamp. Place a small piece of electrical tape on the extra cord to hold it. This way it will not fall back into the lamp body when disconnected from the switch leaving you the difficult task of trying to get it back out.
Unscrew the two brass screws and disconnect the wires from the switch.
With a pair of needle nose pliers, remove the collar on the outside stem of the switch. Then unscrew the stem and remove it. You can now remove the switch itself from inside the lamp.
Install your replacement switch by reversing these steps. Reassemble your lamp and you are done.