Circuit changes, what is the input high and low given when the circuit is lit and not!
A phototransistor works exactly like a regular transistor would, except instead of a base powered by an input bias current, it is turned on and off by light. A NPN type phototransistor will, when lit, turn on, connecting the collector to the emitter.

R1 is a pull-up resistor. It is used to bring a node up through the pull-up resistor to a certain voltage. In this case, the node is the connection between R1 and the Phototransistor's Collector, and R2.

R2 is a series resistor. It will simply limit current flowing through it, and in this case completely optional/unnecessary.

When the phototransistor is on, as mentioned, the collector and emitter are connected in a very low resistance connection. As this is the path of least resistance compared to the high resistance of R1, the node at the Collector pin, will be pulled to it. Since the Emitter is tied to ground, that makes the node tied to ground.