We present various properties of the production of the X (3872) and ψ(2S) states based on 10.4fb‾¹ collected by the D0 experiment in Tevatron p\bar{p} collisions at \sqrt{s} = 1.96 TeV. For both states, we measure the nonprompt fraction fNP of the inclusive production rate due to decays of b-flavored hadrons. We find the fNP values systematically below those obtained at the LHC. The fNP fraction for ψ(2S) increases with transverse momentum, whereas for the X(3872) it is constant within large uncertainties, in agreement with the LHC results. The ratio of prompt to nonprompt ψ(2S) production, (1 - fNP)/fNP, decreases only slightly going from the Tevatron to the LHC, but for the X(3872), this ratio decreases by a factor of about 3. We test the soft-pion signature of the X(3872) modeled as a weakly bound charm-meson pair by studying the production of the X(3872) as a function of the kinetic energy of the X(3872) and the pion in the X(3872) π center-of-mass frame. For a subsample consistent with prompt production, the results are incompatible with a strong enhancement in the production of the X(3872) at the small kinetic energy of the X(3872) and the π in the X(3872)π center-of-mass frame expected for the X + soft-pion production mechanism. For events consistent with being due to decays of hadrons, there is no significant evidence for the soft-pion effect, but its presence at the level expected for the binding energy of 0.17 MeV and the momentum scale Λ = M(π) is not ruled out