One of the main reasons for using opamps as active devices in circuits
is that their internal gain is so high, that even if we reduce it to a
tiny fraction, it will still be enough for practical purposes. This
particular configuration depends on the very high gain of the opamp to
swing the output to one of the extremes; the sign of which tells us
which input is more positive than the other.
By connecting the non inverting input to a voltage source, we are
setting the reference point of the comparator. Remember that since
there's no feedback, & because internally the opamp is just a very
high gain difference amplifier, the output will be the non inverting
input voltage minus the inverting input voltage, multiplied by the
internal gain (in the 100k's).
This means that a difference of just millivolts will drive the output
into saturation; if the difference is positive it will swing to full
positive, limited by the supply. If the difference is negative, it will
swing to full negative, again limited only by the supply.
On most amplifier circuits it is not advisable to drive the opamp into
saturation because it clips the signal from going any further on both
ends, but in this case we are not so much interested in the signal
itself but on the relationship between the signal & a reference, so
this circuit serves its purpose.