These sockets have two terminals, one for the hot wire and one for the neutral. A third contact may be present but is not used for this circuit. This diagram illustrates wiring for a standard, one setting lamp. This socket has two terminals, the brass for hot and the silver for the neutral wire.
With this lamp, bulb A can be turned off and on independently and switch B can turn on bulb 1 alone, bulbs 2 and 3 together with bulb 1 off, bulbs 1, 2 and 3 all on at the same time or all three off.
The neutral and ground wires for the circuit are connected to a bar along the side of the service panel box. The neutral and grounding bars in the box may be separate or, in the case of older service panels, the same bar may be used for both purposes.
New 2-wire cable is run from the receptacle to the new light fixture. At the receptacle the wires are removed and each one is spliced to the new cable and back to the receptacle with a pigtail splice. At the light fixture box the black wire connects to the hot terminal, the white connects to the neutral terminal and the ground to any metal grounding terminal on the fixture, outlet box, or both.
This diagram is similar to the one above, but the switch comes before the new light in the circuit. New cable is run from the receptacle to the new switch location and from there to the light location. The switch may also be added in the the same box with the receptacle as in the diagrams at this link, where the two are installed in a double-gang electrical box.
The plain wire is the hot. If the cord isn’t marked with a bead then the strands of wire will be different colors. In these cases the silver wire is the neutral and the brass colored wire is the hot. The plug on the lamp cord holds another clue to polarity with the wide prong being the neutral and the narrow one the hot. Older lamp cord will have prongs that are the same size. This is because polarity was not observed on electric lamps until the development of grounded circuits.
The source neutral wire on the receptacle is removed and spliced to the white running to the switch, and to a pigtail back to the receptacle neutral. At the switch, the neutral wire is needed to power some dimmer switches and is now required in most switch boxes.
This page contains wiring diagrams for adding a new light fixture using an existing receptacle as the source. Diagrams include adding a light from a switched receptacle and tapping an always-hot outlet. Different wiring arrangements are included to allow for either the light or the switch to come first in the circuit.