We survey some major contributions to Riemann's moduli space and Teichmüller space. Our report has a historical character, but the stress is on the chain of mathematical ideas. We start with the introduction of Riemann surfaces, and we end with the discovery of some of the basic structures of Riemann's moduli space and Teichmüller space. We point out several facts which seem to be unknown to many algebraic geometers and analysts working in the theory. The period we are interested in starts with Riemann, in 1851, and ends in the early 1960s, when Ahlfors and Bers confirmed that Teichmüller's results were correct.This paper was written for the book Lipman Bers, a life in Mathematics, edited by Linda Keen , Irwin Kra and Rubi Rodriguez (Amercian Mathematical Society, 2015). It is dedicated to the memory of Lipman Bers who was above all a complex analyst and spent a large part of his life and energy working on the analytic structure of Teichmüller space. His work on analysis is nevertheless inseparable from geometry and topology. In this survey, we highlight the relations and the logical dependence between this work and the works of Riemann, Poincaré, Klein, Brouwer, Siegel, Teichmüller, Weil, Grothendieck and others. We explain the motivation behind the ideas. In doing so, we point out several facts which seem to be unknown to many Teichmüller theorists.