Basic operation of a light switch. The on/off of a light switch basically only connects and reconnects "one" wire. Imagine if you had a light wired to stay on all the time. You cut the "hot" wire, connect each end to the switch, when the switch in "on", you have reconnected that wire.
In order to have a receptacle ( plug in ) you must have both a hot wire and the "neutral" wire. In a home typically the "hot" is black and the neutral is white. It is recommended to also have a "ground" wire, this will be green or completely bare. For a GFI receptacle to work properly you must have the ground wire also.