The resistors are used to limit the current, R1=510Ω，R2=20kΩ
When receiver receive the return infrared light, the receiver end will connected through, E ends will output high TTL, which close to Vcc value, if not the E ends output low TTL close to GND.
In the cases of real life, we can use MCU to scan E end to check the status.
The white materials absorb less light and reflect most of the light wave; but the black material can absorb most of the light and reflect few. So based on this point, we should just select correct distance (1cm e.g.) and use the circuit above to detect white or black line.