The quantization of the family of linearly polarized Gowdy $T^3$ spacetimes is discussed in detail, starting with a canonical analysis in which the true degrees of freedom are described by a scalar field that satisfies a Klein-Gordon type equation in a fiducial time dependent background. A time dependent canonical transformation, which amounts to a change of the basic (scalar) field of the model, brings the system to a description in terms of a Klein-Gordon equation on a background that is now static, although subject to a time dependent potential. The system is quantized by means of a natural choice of annihilation and creation operators. The quantum time evolution is considered and shown to be unitary, allowing both the Schr\"odinger and Heisenberg pictures to be consistently constructed. This has to be contrasted with previous treatments for which time evolution failed to be implementable as a unitary transformation. Possible implications for both canonical quantum gravity and quantum field theory in curved spacetime are commented.