Redstone Latches
Latches
Latches, also called "flip-flops", are circuits that can be switched between ON and OFF states, and stay that way until switched again. If that sounds really simple: it is!
Use latches whenever you want to turn a short signal (such as a button push, or a daylight detector switching off) into a sustained effect (such as a lamp going on, or a door staying open). There are many types of latches: here are the two easiest and most useful.
T Flip-Flop
T stands for "Toggle": push the button once to switch the light on, push it again to switch the light off.
This circuit makes use of the latching feature of redstone repeaters. The push button unlocks the circuit just long enough for the rest of the circuit to change state, then it locks again (why does it change state? It's really a repeater clock).
The settings of the repeaters are important: they should both be set to maximum delay (3 right clicks each) to allow the circuit to re-latch.
It is also important that the input pulse be the right length. A wooden button emits a longer pulse, so if you wanted to use one of those you'd have to add more repeaters to increase the clock delay.
RS-NOR Latch
Where the T Flip Flop is essentially an ON/OFF button, an RS-NOR latch can be seen as a circuit with separate ON and OFF buttons.
The circuit has two sides, one of which is always on and the other is always off - they are never both on or both off. Sending an input to either side will switch that side OFF and the other side ON, almost as if the two inputs were playing tennis.
This means that for each output, one of the inputs acts as an ON button and the other acts as an OFF button.