A switch can fail because of a damaged switch or bad wire connections. So, the wires connected to the switch or the circuit spliced in the electrical box have come loose.