Unplug the lamp. Remove the lampshade and light bulb.
Pop the socket shell from its base. The socket shell is the cylindrical component that houses the switch. If the shell doesn't come out easily, wedge a screwdriver between the base and the shell and pry it out.
Unscrew the socket base off the lamp by holding the nut beneath the base with a pair of pliers and twisting the base off.
Cut the wires between the socket and the base with wire cutters. There will be two wires.
Strip the plastic covering off the wires so that ½ inch of the wires are exposed.
Tie a knot in the wires that are leaving the socket base. The knot will prevent the wires from pulling out of the base if the cord is tugged.
Identify the neutral wire by finding the wire that has a rib on the plastic covering. Wrap the wire clockwise around the silver screw just beneath the screw head on the replacement socket. Tighten the screw. Wrap the other wire clockwise around the other screw. Tighten that screw.
Pull the cord through the bottom of the lamp and press the socket into the socket base.
Replace the bulb and lampshade.