  We compute fragmentation corrections to hadroproduction of the quarkonium states $J/\psi$, $\chi_{cJ}$, and $\psi(2S)$ at leading power in $m_c^2/p_T^2$, where $m_c$ is the charm-quark mass and $p_T$ is the quarkonium transverse momentum. The computation is carried out in the framework of nonrelativistic QCD. We include corrections to the parton-production cross sections through next-to-leading order in the strong coupling $\alpha_s$ and corrections to the fragmentation functions through second order in $\alpha_s$. We also sum leading logarithms of $p_T^2/m_c^2$ to all orders in perturbation theory. We find that, when we combine these leading-power fragmentation corrections with fixed-order calculations through next-to-leading order in $\alpha_s$, we are able to obtain good fits for $p_T\geq 10$ GeV to hadroproduction cross sections that were measured at the Tevatron and the LHC. Using values for the nonperturbative long-distance matrix elements that we extract from the cross-section fits, we make predictions for the polarizations of the quarkonium states. We obtain good agreement with measurements of the polarizations, with the exception of the CDF Run II measurement of the prompt $J/\psi$ polarization, for which the agreement is only fair. In the predictions for the prompt-$J/\psi$ cross sections and polarizations, we take into account feeddown from the $\chi_{cJ}$ and $\psi(2S)$ states. 
Fragmentation contributions to hadroproduction of prompt $J/\psi$,   $\chi_{cJ}$, and $\psi(2S)$ states