Y can replace a place already mentioned: nous travaillons à Lyon becomes nous y travaillons. It also works for a destination: nous y allons. Put it before the verb, like the single object pronouns you know. This use refers to a place, not to a person.
When stating how many of an already-mentioned kind you take, use en and keep the number: j’en prends deux. Do not repeat livres after deux. Je becomes j’ before en; the verb keeps its usual person form. Compare je les prends, taking the identified set, with j’en prends deux, specifying a quantity.
En also replaces a mass noun when you state an amount. Keep the amount after the verb: j’en achète un peu. Here you are buying some of the coffee being discussed. Do not repeat de café; en already carries that reference.
Il reste introduces what is left or still available. Here il does not refer to a man or an object. Keep reste singular even before a plural quantity: il reste deux livres. This is a different use from a person staying somewhere.