Listen to all your fans
Listen to all of your fans
Name all the states
Name all of the states
What part of language is of in these examples? Is it necessary or optional, correct or incorrect?
Of is just a preposition used to say what group or whole includes the part denoted by the preceding word:
In the case of all, half, and both; of is optional and you can either omit it or keep it.
But you can't leave out of before the pronouns us, you, them, and it *.
*You don't need to worry about this with "both" because you're not going to say "both of it" anyway.
Of can generally be omitted in most cases or reworded to avoid.
For "all of", you could easily replace it with "every" or "each"
In the two examples you gave, the expression could be eliminated entirely with no loss of meaning.
Listen to your fans.
Name the states.
are both clear without adding "all of" or "all"
Whenever I am writing, and I see the word "of" I stop to consider if it can be worded better.