[step:Compute the integrated variance]
For each $x\in\mathbb{R}$,
\begin{align*}
\operatorname{Var}(\hat f_{n,h}(x))
=
\frac{1}{n}
\left(
\mathbb{E}[Y_{h,x,1}^2]-m_h(x)^2
\right).
\end{align*}
First compute the integral of $\mathbb{E}[Y_{h,x,1}^2]$. Since $X_1$ has density $f$,
\begin{align*}
\mathbb{E}[Y_{h,x,1}^2]
=
\frac{1}{h^2}
\int_{\mathbb{R}}K\left(\frac{x-y}{h}\right)^2 f(y)\,dy.
\end{align*}
The integrand $K((x-y)/h)^2f(y)$ is non-negative because $f$ is a density, so Tonelli's theorem justifies interchanging the $x$ and $y$ integrations. Integrating over $x$ and using the substitution $u=(x-y)/h$, so that $dx=h\,du$, gives
\begin{align*}
\int_{\mathbb{R}}\mathbb{E}[Y_{h,x,1}^2]\,dx=\frac{1}{h^2}\int_{\mathbb{R}}\int_{\mathbb{R}}K\left(\frac{x-y}{h}\right)^2 f(y)\,dy\,dx.
\end{align*}
After the substitution $u=(x-y)/h$, this becomes
\begin{align*}
\int_{\mathbb{R}}\mathbb{E}[Y_{h,x,1}^2]\,dx=\frac{1}{h}\int_{\mathbb{R}}f(y)\,dy\int_{\mathbb{R}}K(u)^2\,du.
\end{align*}
Because $f$ is a probability density, the last display equals $R(K)/h$.
Next, by [Young's convolution inequality](/theorems/463) in the case $L^2(\mathbb{R})*L^1(\mathbb{R})\to L^2(\mathbb{R})$, applied to the convolution representation of $m_h$,
\begin{align*}
\|m_h\|_{L^2(\mathbb{R})}
\le
\|f\|_{L^2(\mathbb{R})}\|K\|_{L^1(\mathbb{R})}.
\end{align*}
The right-hand side is finite because $f\in L^2(\mathbb{R})$ and $K$ is compactly supported with $K\in L^2(\mathbb{R})$, hence $K\in L^1(\mathbb{R})$. Consequently,
\begin{align*}
\frac{1}{n}\int_{\mathbb{R}}m_h(x)^2\,dx
=
O\left(\frac{1}{n}\right)
=
o\left(\frac{1}{nh}\right),
\end{align*}
because $h\to0$. Therefore
\begin{align*}
\int_{\mathbb{R}}\operatorname{Var}(\hat f_{n,h}(x))\,dx=\frac{1}{n}\int_{\mathbb{R}}\mathbb{E}[Y_{h,x,1}^2]\,dx-\frac{1}{n}\int_{\mathbb{R}}m_h(x)^2\,dx.
\end{align*}
Combining the two estimates above,
\begin{align*}
\int_{\mathbb{R}}\operatorname{Var}(\hat f_{n,h}(x))\,dx=\frac{R(K)}{nh}+o\left(\frac{1}{nh}\right).
\end{align*}
The condition $nh_n\to\infty$ also records that this integrated variance contribution tends to $0$ along the stated bandwidth sequence.
[/step]