It’s pretty straight forward— you compare the average risk for individuals to the rates for those exposed to carcinogens. For instance, if a population of people develops lung cancer at a rate of 2% by age 70, and a population of smokers has a rate of 10% by age 70– the difference between the base line and the exposed populations becomes the “preventable” count.
I don't know off-hand, but probably a longitudinal survey of cases and pretty rough estimates. It is probably made a bit easier by there being some big chunks which are (likely) more clearly attributable to behavioral choices: smoking-related, sun exposure, and probably some occupational (chemical exposure, etc.).