TITLE: LES for relative cohomology via sheaves
QUESTION [5 upvotes]: I was unable to find a suitable answer for the following question:
Once one learns that singular cohomology is the same as cohomology with coefficients in locally constant sheaf, it is natural to try and understand the meaning of LES for relative cohomology
$\rightarrow H^i(X,U) \rightarrow H^i(X) \rightarrow H^i(U) \rightarrow H^{i+1}(X,U)\rightarrow$
I am curious to what extent it can be interpreted in terms of sheaves on X using functors $j^*,j_*,j_!$?
It seems that there might be some subtleties if $X\setminus U$ is something like a closed subset in Zariski topology as opposed to "thick" closed subsets...

REPLY [6 votes]: Suppose $j:U \to X$ is an open inclusion, and $i: Z \to X$ is the inclusion of the closed complement. Then we have a short exact sequence
$$0 \to j_! \Bbb Z \to \Bbb Z \to i_* \Bbb Z \to 0.$$
I'm going to apply $Ext^*_X(-,{\cal F})$ to this and get a long exact sequence.
Note that $j_!$ is exact with exact right adjoint $j^*$, so that we have an isomorphism
$$
Ext^p_X(j_! \Bbb Z, {\cal F}) \cong Ext^p_U(\Bbb Z, j^* {\cal F}) = H^p(U, j^* {\cal F}).
$$
Moreover, $Hom(i_* \Bbb Z, -)$ is the functor of "sections supported on Z" (a composite of $i^!$ with the global section functor), whose derived functors are called cohomology groups with support on Z and denoted $H^p_Z(X, {\cal F})$.
Therefore, the long exact sequence takes the form
$$
\cdots \to H^p_Z(X, {\cal F}) \to H^p(X,{\cal F}) \to H^p(U, j^*{\cal F}) \to \cdots
$$
The link above will take you to the stacks project where you can find more comprehensive answers to your questions.