Understand how the socket assembly is constructed. On most lamps, a threaded rod runs from the base up to the socket.
The socket has a cardboard insulation sleeve surrounded by a metal housing. The cord runs through the metal rod to the socket, and two screws connect it to the socket.
Unplug the lamp and remove the shade and bulb.
Remove the set screw at the base of the socket and pry the metal housing loose from the rest of the socket.
Remove the cardboard sleeve around the socket to expose the wires.
Unscrew the connections from the socket. One should be darker and normally is copper-colored, while the lighter one usually is silver-colored.
The socket should now unscrew from the threaded rod.
Install the new socket assembly by screwing it onto the threaded rod and connecting the wires to the correct screws. Connect the dark wire to the dark screw and the light wire to the light screw.
Replace the lamp shade and bulb.