Voltage Comparator IC's Output (LM339) Never Goes To VCC (But Can Go To Ground)
The LM339, like a great many other comparators, has an open-collector output - the output is an NPN transistor with the emitter grounded and the collector connected ONLY to the output pin (see Fig. 1 in the datasheet), so the comparator can only pull the output to ground - you need something external, like a resistor to Vcc, to pull the output High.