Scientists look for patterns in data.
Research has established links between cancer and various lifestyle factors, chemicals produced in the body, or that enter the human body, and chemicals in the environment. Scientists have established several causal mechanisms for these risk factors.
Below is an example of how the risk factor of smoking has been studied.
Historically, in the USA, a pattern can be seen in the amount of cigarette use and the incidence of lung cancer.
As the number of cigarettes smoked has increased over the years, the incidence of lung cancer has increased also. As the number of cigarettes smoked decreased, so then did the incidence of lung cancer. Note that there is a time lag, but cancer usually takes some years to develop.
There is a clear association, called a correlation, between the variables.
With cancer and other non-communicable diseases, scientists have found correlations.
If there is a correlation between a particular factor and an outcome, it does not mean that the factor necessarily causes the outcome. Scientists must look for a possible mechanism by which the factor could be the likely cause.
In the case of lung cancer, analyses of cigarette smoke have shown that at least 70 of the chemicals present in smoke will cause cancer in laboratory animals which establishes a causal link.