The sensor is divided into two sections, left and right and will given you an indication when it spots something on either side. With a little clever think, you can also figure out if the object is moving from left to right or the other way around.
HiTechnic have provided an excellent image to show exactly how that works
Plenty more information on how it all works along with sample NXT-G and NXC code can be found here.
If you had one of these, what would you use it for?