We present a simple procedure to obtain the maximally localized Wannier function of isolated bands in one-dimensional crystals with or without inversion symmetry. First, we discuss the generality of dealing with real Wannier functions. Next, we use a transfer-matrix technique to obtain nonoptimal Bloch functions which are analytic in the wave number. This produces two classes of real Wannier functions. Then, the minimization of the variance of the Wannier functions is performed, by using the antiderivative of the Berry connection. In the case of centrosymmetric crystals, this procedure leads to the Wannier-Kohn functions. The asymptotic behavior of the Wannier functions is also analyzed. The maximally localized Wannier functions show the expected exponential and power-law decays. Instead, nonoptimal Wannier functions may show reduced exponential and anisotropic power-law decays. The theory is illustrated with numerical calculations of Wannier functions for conduction electrons in semiconductor superlattices.