I just learned that the word "man" can mean "you", among other things. When would you use "man" instead of du, ihr, and Sie? I can see it being used as an indefinite pronoun, e.g. "One must always be alert", but I have a hard time distinguishing when to use it in place of personal pronouns. Especially when the subject is "you" (sg./pl.) or "they".
When would you use "man" instead of du, ihr, and Sie?
"Man" is used to express a "general rule" where the word "you" in the English sentence actually means: "everyone" or "anyone"
In this supermarket you can buy apples.
In diesem Supermarkt kann man Äpfel kaufen.
The "you" in the English sentence does not mean: You can buy apples but other persons can't. It means: Everyone can buy apples.
"Man" is also used to express that is does not matter (or it is not known) who has done something when the word "they" would be used in English. The word "man" can often be used to express a sentence in active form instead of using the passive.
They told him that the apples were sold out. (active)
He was told that ... (passive)
Man hat ihm gesagt, dass ... (active)
Ihm wurde gesagt, dass ... (passive, just for completeness)