Why add hysteresis to a comparator?
Without it, a slow or noisy input crosses a single threshold several times and the output chatters. With hysteresis the input has to rise past an upper threshold to switch one way and fall below a lower one to switch back, so noise smaller than the gap between them is ignored.

