We formulate and investigate the nonlinear q-voter model (which as a special case includes the linear voter and the Sznajd model) on a one-dimensional lattice. We derive an analytical formula for the exit probability and show that it agrees perfectly with Monte Carlo simulations. The puzzle that we deal with here may be summarized by a simple question: Why does the mean-field approach give the exact formula for the exit probability in the one-dimensional nonlinear q-voter model? To answer this question, we test several hypotheses proposed recently for the Sznajd model, including the finite size effects, the influence of the range of interactions, and the importance of the initial step of the evolution. On the one hand, our work is part of a trend of the current debate on the form of the exit probability in the one-dimensional Sznajd model, but on the other hand, it concerns the much broader problem of the nonlinear q-voter model.