Suppose $f_n(x), f(x)$ are continuous on $[0,1]$ and $\lim_{n\to \infty}f_n(x)=f(x)$ for all $x\in [0,1]$. Since the convergence is not necessarily uniform, there must exist a counterexample to the fact that $$\lim_{n\to\infty} \int_0^1 f_n(x)dx=\int_0^1f(x)dx$$ but I couldn't come up with any. I don't even understand what properties should $f_n$ have to begin with (except that this sequence is not uniformly convergent).
After I finished typing this question, I found this in similar questions. But I'm still wondering how could one come up with such a counterexample or how to come up with a different counterexample? What should I bear in mind to construct it? Obviously the key idea is that the limit of the integral is not the integral of the limit, but what subideas can I exploit?
Let $f_n$ be the tent function with support $[0, 1/n]$ and with $f_n(1/(2n)) = 2n$. Then it's clear that \begin{align} \int^1_0 f_n(x)\ dx = \frac{1}{2}\text{height }\cdot \text{ base} = 1. \end{align} Moreover, $f_n\rightarrow 0$ pointwise everywhere. Fix $x \in (0, 1]$, then there exists $N$ such that $x>N^{-1}$. In particular, we see that for all $n>N$ we have that $f_n(x) = 0$ since $x>\frac{1}{N}>\frac{1}{n}$. Of course, this is not uniform.