A common type of do-it-yourself electrical project is repairing a lamp. Since lamps are somewhat complex - with a number of parts that could be the cause of the problem, spend some time upfront troubleshooting the problem. This will helps focus your repair efforts. Before doing any work on the lamp, make sure that it's unplugged. Never work on a lamp that is plugged in - even if it's turned off. One of the most common problems is a poor connection between the base of the light bulb and the contact in the bottom of the socket. See if the contact is corroded or pushed down into the base. Then scrape off the contact with a screwdriver, pry it up a little, then screw in a light bulb and plug the lamp in. If it works, the problem is solved. But, if it doesn't, further troubleshooting is required - starting by removing the socket.
Most sockets have a "press" marking on the upper cover. Squeezing the cover, allows access to the interior of the socket. Sometimes lamps fail because the wires have come loose from the terminals - so check and make sure that they're securely fastened.
If the wires look fine, the next thing to troubleshoot is the cord. Remove the wires from the screw terminals and use a continuity tester to check the cord. Testing should show two things. First, there should be NO continuity between the ends of the two wires or between the two prongs of the plug. And second, there SHOULD BE continuity between one wire and one prong, and between the other wire and the other prong. If testing fails either of these, then there's a short circuit somewhere in the wire or plug and it should be replaced.
If, however there isn't a problem with the plug, then all possibilities have been eliminated and the socket will have to be replaced. Be sure that the replacement socket matches the original. Once the old socket's removed, simply reattach the wires to the new one. Make sure that the bare wires are twisted tightly before attaching them to the screw terminals. Once the socket's attached, put it inside of the sleeve and put the sleeve into the cover. The final step is to push the cover back down on the base - making sure that the switch is oriented in the correct direction. Then plug it in and see if it works.