How do these phototransistors circuits work?
In Figure 1, R1 feeds a base current to Q1, turning it on.  That in turn feeds a base current to Q2, turning that on, turning on the relay.  If light is then shone on FT, that turns on, diverting the current from R1 to ground, turning off Q1, and hence Q2.

In Figure 2, I would go with the comment by Brian Drummond.  The thing across the terminals of Q2 is probably a diode, to protect it from voltage spikes when the relay is turned off.