LM393 comparator only connects to GND
The LM393 has what's called an open collector output, as shown here from the datasheet.

This means the output can be pulled LOW when the BJT is turned on, but requires an external pull-up resistor to go HIGH when the BJT is turned off.



The typical applications section shows this pull up resistor:



Because of this, I recommend using your first circuit implementation.

Let me know if you have any follow up questions!