En replaces a phrase with de:
- partitive, quantity: Tu veux du pain ? — Oui, j'en veux. (Do you want some bread? — Yes, I want some.) Tu as des enfants ? — J'en ai deux. (Do you have children? — I have two.) The number stays after the verb; English often drops "of them", French never drops en.
- verb + de: parler de, avoir besoin de, avoir peur de, se souvenir de → Tu as besoin de la voiture ? — Oui, j'en ai besoin. (Do you need the car? — Yes, I need it.)
- origin: Tu viens de la gare ? — Oui, j'en viens. (Are you coming from the station? — Yes, I am.)
Y replaces a phrase with à (thing or idea) or a place (à, en, dans, chez, sur):
- place: Tu vas à Genève ? — J'y vais demain. (Are you going to Geneva? — I'm going there tomorrow.) Il est chez lui ? — Oui, il y est. (Is he at home? — Yes, he is.)
- verb + à: penser à, réfléchir à, répondre à (a letter), s'habituer à → Tu penses à ton examen ? — Oui, j'y pense. (Are you thinking about your exam? — Yes, I am.)
For a person, you normally use neither y nor en, but the stressed pronoun: Je parle de Paul → Je parle de lui. (I'm talking about him.) Je pense à mes parents → Je pense à eux. (I'm thinking of them.)
Fixed expressions: il y a (there is / there are), ça y est (that's it, done!), vas-y (go on!), on y va (let's go), s'en aller (to leave), j'en ai marre (I'm fed up), je n'en peux plus (I can't take it any more), je m'en fiche (I don't care).