If there is no variation because everyone in the population agrees, a researcher will be quite accurate regardless of how small the sample is. The number of standard errors from the sample statistic is the confidence interval, while the percentage chance that the true value is outside of the confidence interval is called the confidence level. That is, the researcher can be more certain of being on the target by setting a bigger target. The confidence level and confidence interval are not something that only researchers need to be study. I have described the theory behind simple random sampling.
Many surveys use more complicated sampling designs.
If done correctly, this can produce a more representative sample than simple random sampling. Another option is mutlistage cluster sampling. This is slightly less accurate than a simple random sample, but is often the only method possible or practical. The calculation of the confidence level and confidence interval vary slightly for stratified or multistage cluster samples, but the basics are the same. Randomness allows the researcher to obtain estimates for an entire population using only a properly designed sample.