# Linear Regressions: When to expect the residuals to NOT have conditional mean 0?

Suppose that $$Y, X,$$ and $$U$$ are random variables such that the regression $$Y=\beta_0+\beta_1X+U$$ is the best linear predictor of $$Y$$ given $$X$$.

My question is, when can we expect $$E(U|X)=0$$? I know that this conditional expectation is usually assumed to have mean $$0$$ for OLS and under other specific cases this is also true (such as when $$X$$ is binary). But why is $$E(U|X)=0$$ be generally not true (for example, when $$X$$ takes on other values besides $$\{0, 1\}$$) and are there any ways that we can modify it to make $$E(U|X)=0$$?

The assumption could be violated due to counfouding variables or endogeneity for example. In fact the assumption fails any time there is correlation between $$X$$ and $$U$$ (hence any time $$COV(X,U) \neq 0$$. This actually happens all the time - most of the whole field of econometrics exist to help us deal with this problem.
$$y = \beta_0 + \beta_1 x + \beta_2 z + u$$
but you try to fit just simple regression $$\hat{y} = \hat{\beta_0} + \hat{\beta_1}x$$ and there is correlation between $$x$$ and $$z$$ then the zero conditional mean assumption will be violated because the regression model will attribute any changes in $$y$$ even those caused by $$z$$ to $$x$$. For example, suppose you want to examine the effect of education $$(x)$$ on wages ($$y$$) and also suppose education correlates positively with education of parents ($$z$$) and you exclude the education of parents from your model. In that case the regression model applied to the sample would systematically overestimate the effect of education as it would attribute portion of the effect of parents education to the persons education.