How does a 4 pin IR Object/Proximity Sensor work?
It's a basic IR proximity sensor using a LM358 general purpose op-amp. Not knowing it's specific configuration, it's safe to assume its similar to a simple comparator setup. Diagram from here along with a full detail of how it works, which is how most IR proximity sensors will be wired really.



The two output pins are likely for convenience and will be tied together. You can confirm by looking or using a continuity setting on a multimeter.

Update: Based on the pictures and @RJR's schematic, the two outputs are separate. One provides an on/off digital output, the other provides an analog voltage proportional to the input.

Since it's running at 5V, you will need a voltage divider or level translator to connect it to a RPi input.