With the first proton-proton collisions in the Large Hadron Collider (LHC) at CERN in 2010, a new era in high energy physics has been initiated. The data collected by the various experiments open up the possibility to study standard model processes with high precision, in new areas of phase space. The LHC provides excellent conditions for studies of quarkonium production, due to the high quarkonium production rates given the high center-of-mass energy and high instantaneous luminosity of the colliding proton beams. Studies of the production of heavy quarkonium mesons - bound states of a heavy quark and its respective antiquark - are very important to improve our understanding of hadron formation. Until quite recently, experimental and phenomenological efforts have not resulted in a satisfactory overall picture of quarkonium production cross sections and quarkonium polarizations. The Compact Muon Solenoid (CMS) detector is ideally suited to study quarkonium production in the experimentally very clean dimuon decay channel, up to considerably higher values of transverse momentum than accessible in previous experiments. The scope of this thesis is to describe in detail the measurements of the polarizations of the Upsilon(nS) bottomonium states and (in less detail) of the Psi(nS) charmonium states, based on a dimuon data sample collected with the CMS detector in proton-proton collisions at a center-of-mass energy of 7 TeV. Surprisingly, no significant polarizations were found in any of the studied quarkonium states, in none of the studied reference frames, nor in a frame-independent analysis. From an experimental point of view, these results, together with recent results from other experiments, clarify the confusing picture originating from previous measurements, which were plagued by experimental ambiguities and inconsistencies. The currently most favored approach to model and understand quarkonium production is non-relativistic quantum chromodynamics (NRQCD), a QCD-inspired model which allows color-octet pre-resonant quark-antiquark states to contribute to quarkonium bound state formation. The measurements obtained as a result of this work, together with other LHC measurements in the field of quarkonium production, are interpreted with an original phenomenological approach within the theoretical framework of NRQCD, guided by the observation of a few general features of the data, and corroborated by a detailed study of the quarkonium production cross section and polarization observables. This phenomenological analysis leads to a coherent picture of quarkonium production cross sections and polarizations within a simple model, dominated by one single color-octet production mechanism. These findings provide new insight in the dynamics of heavy quarkonium production at the LHC, an important step towards a satisfactory understanding of hadron formation within the standard model.