Some simple example that illustrates that the condition $$\lim_{|x|\to \infty} f(x) = 0 \quad (1)$$ is not necessary. If the condition were necessary $f\in L^2$ would imply that the limit in (1) holds. Take in dimension 1 the function $$ f(x) = \sum_{n=1}^{\infty} \chi_{I_n}(x) $$ where $\chi_{I_n}$ is the characteristic function of the interval $I_n = [n-\frac{1}{n^2}, n+\frac{1}{n^2}]$ then the integral evaluates to $$ \int |f(x)|^2 dx = \sum_{n=1}^{\infty} |I_n| = \sum_{n=1}^{\infty} \frac{2}{n^2} < \infty\ . $$ But the function does not converge to zero for $|x|\to \infty$. Sorry: Forgot to center the intervals around n. Now corrected.