Du versus Sie (and ihr)
Du (informal singular): you use this form with family, close friends, children, pets, deities, and if you're younger, your peers
Gehst du heute in die Schule?
Sie (formal singular and plural): Pretty much in every other situations, you use Sie.*Sie* is especially used with adult strangers, and generally among white-collar colleagues (office, bank, etc vs a blue-collar job) or other professional environment. Technically, Sie is also the plural and thus if you would siezen the individuals in the group you'd siezen them as a whole.
Haben Sie den Bericht geschrieben?
ihr (plural): this form is technically the plural of du (you all), but is sometimes used collectively towards people you'd use Sie with individually.
Ihr müsst das Projekt bald fertig machen.
As you may have seen, Sie and all its forms are always capitalized
Sie haben die Ampel überfahren
Ich habe das für Sie mitgebracht
Das passt Ihnen gut
Ist das Ihr Hemd?
Du and ihr and their respective forms can be capitalized, but it's not required like it is with Sie
Another more prominent difference in conjugation
You may have also noticed that Sie
(you) and sie
(them) match up in spelling, pronunciation and conjugation. The only way to tell the difference is context; it's usually reasonably clear. In 2 and half years of learning German, I can't remember one time when I the two words being the same tripped me up.
It's hard to draw a line between the two words, because German is a living language so who you can duzen and who you should siezen is constantly changing and different people have different views and ideas about the two. Doing a search on this StackExchange shows how hard it can be and how there can be many different cases.
Du vs Sie should not be compared with tu versus vous or tú versus Ud. in French and Spanish respectively, because these languages all define the distinction differently.
The 'du/Sie' dilemma in German
When to use du and Sie
Du and Sie
The du und du waltz