The thermal Sunyaev-Zeldovich (tSZ) effect is one of the primary tools for finding and characterizing galaxy clusters. Several ground-based experiments are either underway or are being planned for mapping wide areas of the sky at $sim 150$ GHz with large-aperture telescopes. We present cosmological forecasts for a straw man tSZ survey that will observe a sky area between $200$ and $10^4$ deg$^2$ to an rms noise level between 2.8 and 20.2 $mu$K-arcmin. The probes we consider are the cluster number counts (as a function of the integrated Compton-$Y$ parameter and redshift) and their angular clustering (as a function of redshift). At fixed observing time, we find that wider surveys constrain cosmology slightly better than deeper ones due to their increased ability to detect rare high-mass clusters. In all cases, we notice that adding the clustering information does not practically improve the constraints derived from the number counts. We compare forecasts obtained by sampling the posterior distribution with the Markov-chain-Monte-Carlo method against those derived using the Fisher-matrix formalism. We find that the latter produces slightly optimistic constraints where errors are underestimated at the 10 per cent level. Most importantly, we use an analytic method to estimate the selection function of the survey and account for its response to variations of the cosmological parameters in the likelihood function. Our analysis demonstrates that neglecting this effect (as routinely done in the literature) yields artificially tighter constraints by a factor of 2.2 and 1.7 for $sigma_8$ and $Omega_mathrm{M}$, respectively.