TITLE: residually finite-by-$\mathbb{Z}$ groups are residually finite
QUESTION [10 upvotes]: I believe I read somewhere that residually finite-by-$\mathbb{Z}$ groups are residually finite. That is, if $N$ is residually finite with $G/N\cong \mathbb{Z}$ then $G$ is residually finite.
However, I cannot remember where I read this, and nor can I find another place which says it. I was therefore wondering if someone could confirm whether this is true or not, and if it is give either a proof or a reference for this result? (If not, a counter-example would not go amiss!)
Note that I definitely know it is true if $N$ is f.g. free (this can be found in a paper of G. Baumslag, "Finitely generated cyclic extensions of free groups are residually finite" (Bull. Amer. Math. Soc., 5, 87-94, 1971)).

REPLY [9 votes]: I think what Yves meant in his comment to Andreas' answer is the result of Mal'cev [A. I. Mal'cev, On homomorphisms onto finite groups, Ivanov. Gos. Ped. Inst. Ucen. Zap., 18 (1958), pp. 49-60, in Russian] stating that any split extension of a finitely generated residually finite group by a residually finite group is residually finite. This is indeed an easy exercise. In particular, this implies that every (f.g. residually finite) - by - Z group is residually finite as every extension by a free group (e.g., by Z) splits. 
If either of the conditions "finitely generated" or "split" is relaxed, the result does not hold. The counterexample with infinitely generated kernel is already provided by Yves. For non-split extensions there are even examples of the form $$1\to \mathbb Z/2\mathbb Z \to G\to Q\to 1,$$ where $Q$ is (finitely generated) residually finite while $G$ is not. In particular, being residually finite is not a quasi-isometry invariant.
Such examples can be found among solvable (moreover, center-by-metabelian) groups or even among groups of intermediate growth (see [A. Erschler, Not residually finite groups of intermediate growth, commensurability and non-geometricity, Journal of Algebra, 272 (2004), 154-172].