  Spatial confounding is a fundamental issue in regression models for spatially
indexed data. It arises because spatial random effects, included to approximate
unmeasured spatial variation, are typically not independent of the covariates
in the model. This can lead to significant bias in covariate effect estimates.
Despite extensive research, it is still a topic of much confusion with
sometimes puzzling and seemingly contradictory results. In this paper we
develop a broad theoretical framework that brings mathematical clarity to the
mechanisms of spatial confounding, providing explicit and interpretable
analytical expressions for the resulting bias. From these, we see that it is a
problem directly linked to spatial smoothing, and we can identify exactly how
the features of the model and the data generation process affect the size and
occurrence of bias. We also use our framework to understand and generalise some
of the main results on spatial confounding in the past, including suggested
methods for bias adjustment. Thus, our comprehensive and mathematically
explicit approach clears up existing confusion and, indeed, demystifies the
issue of spatial confounding.
