The magnetic field of the Sun and the plasma properties of its atmosphere, such as temperature, density and waves in the solar corona, determine the origin, energetics and evolution of the solar wind. The solar wind comes in three main kinds, as steady fast streams, variable slow flows and transient fast coronal mass ejections, with all being closely associated with the structure and activity of the coronal magnetic field that evolves on a multitude scales. This tutorial paper places emphasis on the observed and measured characteristics of the solar wind sources and their magnetic structure. The boundary conditions in the magnetically closed corona, in the transiently opening corona, and in the lastingly open corona (funnels and holes) will be discussed, and their influences on and consequences for the interplanetary solar wind be addressed. The resulting three-dimensional structure of the solar wind and its evolution over the solar cycle are also briefly discussed.