What happens when the level of a comparator's input signal crosses the threshold voltage?
Why A comparator continuously compares its input voltage against a reference (threshold) voltage using very high open-loop gain. As soon as the input passes that reference, even by a millivolt, the huge gain drives the output to one supply rail or the other, so the output flips between its two logic states. That is what makes comparators useful as analog-to-digital threshold detectors, level sensors and squaring circuits.
Watch out The choice about the reference level appearing at the output describes a buffer or voltage follower, not a comparator; a comparator's output is a saturated high or low, not a copy of the reference.
Comparator = one-bit ADC: input above reference, output slams high; below, output slams low.