When should I use どちら and when should I use どちらの for asking a which-question?
My intuitive understanding is that どちらの is used when one wants to ask "which [noun] ..." (e. g. どちらの色が好きですか) but I'm not sure why the の particle is used here.
This question is all but same with the following one except the word itself.
の is a case particle which lets a noun modify another noun. Unlike English where you can directly attach a noun to another (summer vacation, Disney movie), Japanese always needs の between them. Only personal pronouns retain the rigid distinction in English, so you can simply know which to use by replacing it with a grammatically equivalent personal pronouns.
どちらの色が好きですか
Which (↔ my, your, their, whose) color do you like?
どちらが好きですか
Which (↔ me, you, them, who) do you like?
cf. どちらのが好きですか
[Of] which (↔ mine, yours, theirs, whose) do you like?
The same applies to all question words, pronouns, and nouns. Beware that Japanese has many common noun suffixes in use, which translated to a full word in English, but is only an attachment to a free-standing noun.
どちら用ですか (用 = "—'s purpose")
For which purpose / whose usage?どちら行きですか (行き = "bound for —")
Where is (it) going?