How exactly does a 3-way switch work?
Here's a diagram. On the left the hot wire comes in and is switched to one of two wires going to the othe switch. The right switch selects eithe the on or off wire from the other switch. So either switch can be toggled to turn the light on or off.