Case 1. As an adverb: “there” (to refer to a place):
Hij heeft er vijf jaar gewoond. — He lived there for five years.
Er is used only when in an unstressed position. When it should be under stress, daar is used instead:
Daar heeft hij vijf jaar gewoond.
Case 2. As a pronoun: het, hem and ze, when used to refer to things, cannot be used after prepositions. The following construction is used instead: er + preposition:
De kinderen spelen vaak ermee. — The children often play with it.
Hij heeft een half uur erop gewacht. — He has waited for it for half an hour.
er and preposition may get separated by some other words. For example:
De kinderen spelen er vaak mee.
Ik heb er een half uur op gewacht.
In this case er can be replaced by hier and daar, meaning “this” and “that” respectively.
Er is replaced with waar when asking a question.
Here’s the summary by example:
De kinderen spelen vaak ermee. — The children often play with it.
De kinderen spelen er vaak mee. — The children often play with it.
De kinderen spelen hier vaak mee. — The children often play with this.
De kinderen spelen daar vaak mee. — The children often play with that.
Waar spelen de kinderen mee? — What are the children playing with?
Case 3. Talking about quantity or amount: in this case it means “of it” or “of them”.
— Hoeveel kaarten heb je? — How many tickets do you have?
— Ik heb er drie. — I have three (of them)
Ik heb er genoeg gehad. — I’ve had enough (of it/them).
“Ik heb er drie” — is the only right way to say this. Er should always present in such an expression!
Ik heb er genoeg gehad. — I’ve had enough (of it/them).
Case 4. To express the “there is” / “there are” construction (a sentence with an indefinite subject):
Er staat een man op straat. — There’s a man standing in the street.
Vanmorgen was er geen melk in de koelkast. — There was no milk in the fridge in the morning.
Invert er and the verb to form a question:
Is er geen melk in de koelkast? — Is there no milk in the fridge?