Optical switch operation point derivation
In your circuit, you want Vout to switch between 5 V and almost 0 V, so you want the phototransistor to saturate.
So you send 20 mA through the LED, and size R2 for a current of 400 µA when dropping about 5 V:

R2 = 5 V / 400 µA
   = 12.5 kΩ


(I'm assuming Vce=0 because the maximum Vce(sat) value does not tell you much about the actual value. Anyway, assumig Vce = 0.2 V would result in a nice E12 value of 12 kΩ. Or use 15 kΩ to be sure.)