How can endogeneity arise in OLS estimation? The definition of endogeneity is: $$\mathbb{E}(\varepsilon \vert X)\neq0,$$ which I know is not quite the same as: $$\text{Cov}(\varepsilon, X)\neq0.$$  My question is, how can this occur in OLS, where by construction $\varepsilon \perp X$?  
Is it due to some kind of non-linear effects, where $\text{Cov}(\varepsilon, X)=0$, but $\mathbb{E}(\varepsilon \vert X)\neq0$?
 A: from my point of view this problem stems from the fact that OLS models a linear projection $L(Y|X)=X\beta$ that is defined such that we always have $(Y-L(Y|X))⊥X$ but it does not hold in general that $L(Y|X)=X\beta=E[Y|X]$.
As a example assume that $Y=X+X^2+e$ and $E[Y|X]=X+X^2$, if we now do not account for the squared term, i.e. estimate a linear projection $L(Y|X)=X\beta$ we effectively say $Y=X+\epsilon$ and $\epsilon=X^2+e$. Or in other words, we put the $X^2$ in the error term. By the basic calculation rules of random variables (and assuming that $e\sim iid(0,\sigma)$) it holds that
$$Cov(\epsilon,X)=Cov(X^2+e,X)=Cov(X^2,X)=0$$ but clearly $$E[\epsilon|X]=E[X^2|X]\neq 0$$
Therefore, your suspicion of non-linear effects is quite right, but the more deep reason is that modelling via OLS is not necessarily the same as modelling the conditional expectation.
But more broadly speacking, enogeneity in general can have three reasons (as shown in standard textbooks like Wooldridges "Econometric analysis of cross section and panel data"). Classical is the omitted variable problem that stems from the confusion of the error term of the OLS estimator and the error term of the "real" model. Second is the measurement error problem where we control for all relevant covariates but some of the error in the measurement of them goes into the error term and third is the problem of Simulateneity. Therefore, I would say that your remarki that "endogeneity [can] be thought of as another manifestation of omitted variable problem" is correct. However, endogeneity must not necessarily stem from a omitted variable but can also have other sources.
I would clearly refer to the book of Wooldridge, especially Chap. 2 for the concepts of the conditional expectation (what we want to estimate) and linear projection (what we have at hand if we use OLS) and Chap. 4 for the problem of endogeneity and its sources.
