Derived base change in étale cohomology Given a commutative square of ringed topoi
$$\begin{array}{ccc}X'\!\! & \overset{f'}\to & Y'\!\! \\ \!\!\!\!\!{\small g'}\downarrow & & \downarrow{\small g}\!\!\!\! \\ X & \underset f\to & Y\end{array}\label{Dia square}\tag{1}$$
and an object $K \in D(X)$, there is a canonical base change morphism
$$Lg^*Rf_* K \to R(f')_* L(g')^* K;\label{Dia base change}\tag{2}$$
see for example [Stacks, Tag 07A7].
Coherent story. Assume (\ref{Dia square}) is a pullback square of schemes (with their categories of $\mathcal O_X$-modules), where $f$ is qcqs and $K \in D_{\mathbf{Qcoh}}(X)$. If $g$ is flat, then (\ref{Dia base change}) is an isomorphism [Stacks, Tag 02KH]. This holds more generally if $X$ and $Y'$ are tor independent over $Y$ [Stacks, Tag 08IB]. There are also versions demanding only that $K = \mathscr F \in \mathbf{Qcoh}(X)$ is flat over $Y$ and of finite presentation on $X$, at least if $f$ is proper and of finite presentation [Stacks, Tag 0B91].
It seems that the failure of (\ref{Dia base change}) to be an isomorphism is mostly explained by derived phenomena. When $X$ and $Y$ are not tor independent, it seems conceivable to me that the failure of (\ref{Dia base change}) to be an isomorphism can be salvaged by taking $X'$ to be the derived base change $X \times_Y^{\mathbf L} Y'$ instead of the usual base change (are there any results of this type?).
Étale setting. Now let (\ref{Dia square}) be a pullback square of schemes (or even $\mathbf C$-varieties if you like), but now equipped with the étale topoi of $\mathbf Z/n$-sheaves. If you like, you may assume $K \in D_{ctf}(X_{\operatorname{\acute et}}, \mathbf Z/n)$ (constructible with locally finite tor dimension, see e.g. [Stacks, Tags 03TQ and 08CG]).
Because the sheaf of rings $\mathbf Z/n$ doesn't change, all pullbacks $g^*$ are already exact, so $Lg^* = g^*$. In particular, we already see that flatness and tor independence are not the issue. However, the base change map (\ref{Dia base change}) is not always an isomorphism:
Example. Let $X = \mathbf A^2 \setminus \{0\}$ and $Y = \mathbf A^1$, where $f$ is the first coordinate projection. Let $Y' \subseteq Y$ be the origin, so that $X' = \mathbf A^1 \setminus \{0\}$.
Let $K = \mathbf Z/n[0]$. Then $Rf_*K$ is a complex whose $H^0$ is $\mathbf Z/n$ and whose $H^3$ is $g_*(\mathbf Z/n)$ (the constant sheaf at the origin). On the other hand, $(g')^* = \mathbf Z/n[0]$, and $R(f')_*(g')^*K$ is a complex whose $H^0$ is $\mathbf Z/n$ and whose $H^1$ is $\mathbf Z/n$. So it differs from $g^*Rf_*K$.

Question. Can the failure of cohomology to commute with base change be explained by certain derived phenomena?

For example, is the situation better if we replace $X'$ with some sort of homotopy fibre (when $Y' \subseteq Y$ is a point) or more generally a homotopy fibre product?
It seems that there cannot be a Grothendieck complex that computes $Rf_*K$ after arbitrary base change, because $g^*$ is always exact. So the situation is really fundamentally different from the coherent case, where the non-flatness of $g^*$ accounts for the failure of cohomology to commute with nonderived base change (at least in the situations described above where derived base change holds).
 A: Here is a long comment about the étale setting.
If $X\to Y$ is a universal homeomorphism of schemes (or Deligne-Mumford stacks), then it induces an equivalence of small étale sites, and thus of topoi:
$$X_{\acute et}\cong Y_{\acute et} .$$
This remains true for derived schemes/Deligne-Mumford stacks: is X is a derived scheme, and if $tX$ denotes its truncation (same underlying space but with $\pi_0(\mathcal O_X)$ as structural sheaf), then the canonical closed immersion $tX\to X$ induces an equivalence of small étale sites (i.e. it is the same to determine an étale map to $X$ or an étale map to $tX$). In particular, extending the formalism of étale cohomology to derived schemes does not change the cohomology groups nor the (derived) categories of étale sheaves. This does not mean that derived geometry is not interesting in this context (on the contrary, this means that there are new cohomology classes which have a geometric interpretation if we allow derived geometry in the picture). But this means that derived geometry will not change anything about the obstruction to base change in the étale context.
However, one may see the theory of sheaves as an extension of intersection theory, where (constructible) sheaves are "cycles". In fact, if $F$ is a constructible sheaf on $X$, one defines a cycle (or equivalently a constructible function with values in $\mathbf Z$) by taking the rank (or the Euler characteristic) of each fiber of $F$.

*

*If $F$ and $G$ are in $D^b_{ctf}(X,\Lambda)$, then the (derived) internal Hom
$$Hom(F,G)$$
may be seen as an "intersection pairing".

*There is a pullback of sheaves induced by a morphism of schemes $f:X\to Y$,
$$f^*:D^b_{ctf}(Y,\Lambda)$\to D^b_{ctf}(X,\Lambda).$$

*There is also a pushforward $Rf_!$ (with compact support).

If $f:X\to Y$ is a map of schemes over a base schemes $S$ and $F\in D^b_{ctf}(X,\Lambda)$, we may wonder if the formation of $Rf_*(F)$ is compatible with base change of the form $S'\to S$. It so, we may say that $F$ and $f$ are transversal to each other. Deligne's generic base change theorem says that there is a dense open subscheme of $S$ over which $F$ and $f$ are indeed transversal. On the other hand, if $f$ is smooth, it is transversal to any $F$. It is tempting to say that $F$ is smooth if it is transversal to any $f$; the good news is that this is exactly what we do, up to a translation between French and English: in the $\ell$-adic context, when $\Lambda=\mathbf Z_\ell$, $\mathbf Q_\ell$, $\bar{\mathbf Q}_\ell$, one can prove that a sheaf $F$ is smooth in the sense above if and only if it is lisse in the usual sense! In this sense, Deligne's generic base change theorem is a kind of sheaf-theoretic Bertini theorem.
One can also say when two sheaves $F,G\in D^b_{ctf}(X,\Lambda)$ are transversal to each other: this is when
$$f^*Hom(F,G)\cong Hom(f^*F,f^*G)$$
for all maps $f:X'\to X$.
Another notion of smoothness for a sheaf $F$ would be that it is transversal to all sheaves $G$. One shows that this notion of smoothness relatively to sheaves is in fact equivalent to the notion of smoothness relatively to morphism of schemes, i.e. to the property of being lisse. Interestingly enough, we have a big locus of smoothness: for any $F\in D^b_{ctf}(X,\Lambda)$, there is a dense open subscheme $U$ such that $F|_U$ is lisse in $D^b_{ctf}(U,\Lambda)$.
The transversality property between sheaves (or between sheaves and morphisms) can be seen through the singular support (whose behaviour is very strongly related to vanishing cycles). This is developped in full in the context of (archimedian) analytic geometry in the book of Kashiwara and Schapira "Sheaves on Manifolds" and has been developped recently in the context of étale sheaves on schemes by A. Beilinson and T. Saito. There remains the problem of the compatibility between the operations on schemes and the operations on the associated cycles (there is a more clever way to construct cycles associated to sheaves: the characteristic cycles). In particular, with the pushforward. From a curve to a point, this is the Grothendieck-Ogg-Shafarevitch formula; the general case is not fully understood yet (in positive characteristic). But the conclusion of all this is that the behaviour of base change formulas, that is the control of pushforward functors has maybe more to do with ramification theory than with derived geometry. This does not mean that derived methods have nothing to say though: the work of Toën and Vezzosi on Bloch's conductor formula goes through non-commutative motives, Voevodsky's motives and trace formulas for modules over $E_n$-algebra with $n<\infty$.
