In the collection of data to study a population of interest there could be said to be two main methods of sampling - probability sampling and nonprobability sampling.
It is usual for experiments to use probability sampling as opposed to nonprobability sampling as probability sampling is best scientific practice (or gold standard).
With probability sampling, in the simplest case, every member or unit of the population of interest (or the target population) has an equal chance of being selected for the study. For more complicated study designs, some stratification might occur so that there is proportional representation of certain groups, for example age-sex bands or socio-economic strata. However, within those defined groups, whose size mirror the proportion of the strata in the target population, members still have an equal chance of being selected for the study. The sampling design in these situations isn't fully random, but does still have a randomisation element that allows for standard errors on estimates to be calculated. An argument against randomised sampling is based on ethics. Particularly in clinical studies it is sometimes viewed as unethical to randomise when quality of life or even life itself is at stake. In such cases, more severely ill patients are prioritised for inclusion as a first step in establishing a treatment. The inherent truth of the matter however is that there is often a price to pay (sometimes high) for progress in science.
It is typically surveys above any other type of study that employ nonprobability sampling, though experiments might have reduced randomness in their sampling design due to ethical considerations for example, as mentioned above.
Though it is best practice from the point of view of scientific investigation to choose samples from the population at random, sometimes practical issues make this impossible. It may be that the sample is entirely nonrandomly chosen as it is the only one available. This significantly limits the possibility of generalising the results of the study to the wider population of interest as standard errors cannot be accurately calculated, and also significant bias may distort the results away from the picture in the wider target population. Most importantly, it is scientific malpractice to deliberately choose a sample that is biased (the bias is referred to as exclusion bias) in the direction of the desired result, for example asking clientele of an expensive shop if they prefer one's brand to a cheaper brand. If the randomness of a collected sample for a study is limited this should be stated in reports of the study so that it's limitations and the problems they entail are 'above board'.