What if only one switch was installed on the stairs?
Suppose there is only one light switch at the top of the stairs. What if You trying to descend the stairs presses a switch to descend the stairs, and then how turn off the light? Will you go up again, turn it off, then come down again?
In this case, you should be able to turn off the lights even if you don't go up the stairs again after coming down. The same goes for going up the stairs. You should be free to switch on and off anywhere on the stairs. The solution is to install the switches at the top and bottom, respectively.
The switch used at this time is a 3-terminal switch. Most of the switches that are commercialized and produced as parts actually have more than 3 terminals.
When the two switches' terminal selections on the stairs match each other, current flows in the circuit. When the upper switch and the lower switch are in the same direction, the circuit is connected, and the light is lit. If the line deviates from each other, the circuit breaks and the lights turn out.