Three-way light switches, used where you want to control a light from two locations, such as from both ends of a staircase or hall, are built and wired a little differently than a conventional single-pole wall switch. For starters, they don't have "OFF" and "ON" printed on the toggle and they don't have a top and bottom.
Also, rather than having two terminal screws like a conventional single-pole light switch, a three-way switch has three. On most of these switches, two of the terminals are the same color (typically silver or brass) and the third terminal, called a "common terminal," is a different, often darker, color. Not all three-way switches have these terminals placed in the same configuration, so you have to pay attention to their colors when wiring them.
Refer to the illustrations below for doing the rough-in wiring for each of these situations. Please note that these diagrams assume that you're following all recommended practices for safe installation of electrical circuits and that the power to the circuit is always turned off when working with exposed wires.
It's important to recognize that a light switch is designed to interrupt the "hot" wire when it's turned off. With this in mind, the white wire from the power source always goes uninterrupted to the light fixture and the bare grounding wires are always fastened to grounding screws. With a three-way switch, three wires connect the pair of switches---two black "traveller" wires and a third "common" wire. When the circuit's power is turned on, any of these may be "hot," depending upon how the switches are toggled. Because "3-wire-with-ground" non-metallic electrical cable such as Romex contains a white wire, the white wire can be painted or taped black to serve as an additional black (hot) wire when used as the connecting wires between two three-way switches.There are three basic ways three-way switches may be set-up to control one or more lights. The right one to choose will depend upon the placement and relationship of the switches and lights.
A) The wires from the power source may enter one switch box first, then travel to the light, then terminate at the other switch.
B) The wires from the power source may enter the light fixture box first, then travel to one switch and then connect that switch to the other switch.

C) The wires from the power source may enter one switch box first, then travel to the other switch box, and then go to the light.

--DV