How exactly does a comparator work?
At the heart of a comparator is a long-tailed pair. This subcircuit is used to take the difference between the two voltages directly, and then this difference is amplified by the rest of the comparator circuit to be as close to the rails as possible (although a OC comparator will only ever either pull the output low or float it).