How can I use a comparator in a circuit?
Electronics Tutorials actually has a very good diagram of this.



Henceforth, when you're talking about reference voltages, it can depend on the structure of the reference voltage itself and it can be determined by Kirchhoff's Laws, i.e. Kirchhoff's Current Law.



If you have any more questions, I invite you to check out that hyperlink I put at the beginning of my answer.