Er is one of the most frequently used and most puzzling words in Dutch. It has at least four distinct functions. Function one: existential er (existentieel er). Er is used with zijn to express existence: Er is een probleem (There is a problem). Er zijn veel mensen (There are many people). Er was niets te doen (There was nothing to do). This er is equivalent to English there in there is/there are and is obligatory — you cannot omit it.
Function two: anaphoric er replaces a prepositional phrase referring to a thing (not a person). The preposition combines with er: op + er = erop, aan + er = eraan, voor + er = ervoor, etc. Ik denk eraan (I am thinking about it — aan + er). Ze is er blij mee (She is happy about it — met + er = ermee). Hij wacht erop (He is waiting for it — op + er = erop). This replaces prepositional phrases: instead of Ik denk aan het probleem, you use Ik denk eraan. For people, use pronoun + preposition: Ik denk aan hem.
Function three: partitive er replaces a quantity expression. Hoeveel appels heb je? Ik heb er drie (I have three — er stands in for appels). Heb je vrienden? Ik heb er veel (I have many — er stands in for vrienden). Function four: positional filler er. When the subject of a clause is moved to after the verb (for instance with passive or impersonal constructions), er fills the subject position: Er wordt hier niet gerookt (Smoking is not done here — er fills first position). Er werd gezongen en gedanst (There was singing and dancing). Mastering er requires seeing many examples in context.