How to connect IR sensor

Ah, a proximity sensor.
Still, things will be much the same.

Shame that website isnt doling out the datasheet which would be immesely helpful to you most likely. Check it out.

But going from that website you gave and cable colours, the red will likely need 5V, ground the black, and then connect the yellow to an analog pin (0-5), and thats it.

Sensor reports an analog value based on distance observed to the analog pin (on the yellow wire). Too easy.