There are several types of common electrical switch available. Single-pole single-throw and single-pole double-throw switches are the most commonly used. Both types of switch are easy to wire, if you know what they do and what to look for.
An SPST switch has two wires coming out of it. Simply connect one wire to the positive terminal of the power supply and the other wire to the positive terminal of the component to be switched on or off. Alternatively, you can make the connections to the negative terminals with the same effect. Closing the switch simply completes the circuit and allows electricity to flow through the device.
An SPDT switch, rather than turning a component on or off, often switches a component between states--high and low, for example. It also may switch power from one circuit to another. There will probably be four wires coming out of the switch. The ground wire is most likely green, and should be connected to a good ground.
Connect the power wire (most likely red) to the positive terminal of the power source.
Connect each of the two remaining wires (most likely black) to the power inputs for each of the component's different states, or to the power inputs of each circuit. Flipping the switch one way will allow electricity to flow through one circuit, or to power one of the device's states. Flipping the switch the other way will remove power from the first circuit and route it to the other.
Make your connections tight. Use solder if necessary. Loose connections may not only affect performance, but may cause a short circuit, which can cause a fire.