Despite the endless variety of lamp styles and decorative elements, most lamps have very similar electrical components. This means that if one part stops working, you can simply remove it and take it to the hardware store or home center to find a suitable replacement. A failed pull-chain switch is no exception. In most cases, you fix a bad switch by replacing the entire socket, since the switch is typically integrated with the socket. Shopping excluded, the whole job should take less than 30 minutes.
Unplug the lamp and remove the light bulb from the socket. Remove the shade or globe. If applicable, remove the harp (the wire frame that supports the shade) by squeezing the two ends together and slipping them out of the brackets at either side of the socket assembly.
Remove the cylindrical metal casing surrounding the socket by squeezing in around the casing where it fits into a base piece; sockets often have the words "PRESS" stamped in the places where it's best to squeeze on the casing. Pull the casing off the socket assembly.
Slip off the cardboard insulating sleeve from the socket to expose the screw terminals securing the lamp cord wires. Loosen the terminals with a screwdriver and disconnect the wires. This should free the socket; if not, look for mounting screws securing the socket to the base and remove the screws to free the socket.
Purchase a replacement socket with a switch that closely matches the original. The sockets may vary slightly in height and appearance, but the diameters must be identical.
Connect one of the lamp wires to each terminal on the socket, as before. Reassemble the socket in the reverse order of the disassembly. It's usually fine to use the original base (to save time), even if the replacement socket includes a base.
Reinstall the harp, shade and bulb. Plug in the lamp and test the new switch.