The answer to 'how does switch work' is that a switch is an electrical device that controls the flow of electricity in a circuit. When a switch is in the 'on' position, it allows electricity to flow through the circuit and power the connected devices. When the switch is in the 'off' position, it breaks the circuit and stops the flow of electricity, turning off the connected devices.
Switches work by physically opening or closing a circuit. Inside a switch, there are metal contacts that can be moved to connect or disconnect the wires in the circuit. When the switch is turned on, the contacts touch, completing the circuit and allowing electricity to flow. When the switch is turned off, the contacts separate, breaking the circuit and stopping the flow of electricity.