Let $ \Omega \subset \mathbb{R}^n $ be open and bounded. We aim to show that for $ u $, a real infinitely differentiable function with compact support in $\Omega$ (where $ \Omega $ is contained in $ \left(-\frac{L}{2},\frac{L}{2}\right)^n $):
$ \int_\Omega u^2 \,dx \leq \left(\frac{L}{2\pi}\right)^2 \int_\Omega |\nabla u|^2 \,dx $
By using Fourier series I've shown that
$ u = \sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n} \left(\frac{1}{L^n} \int_{\left[-\frac{L}{2},\frac{L}{2}\right]^n} \overline{e_k} u \,dx\right) e_k $
where $ e_k $ is simply the function $ x \mapsto e^{ikx} $. Set $\hat{u_k} = \int_{\left[-\frac{L}{2},\frac{L}{2}\right]^n} \overline{e_k} u \,dx.$ So we have $u = \sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n}\hat{u_k} e_k.$
Similarly,
$ D_ju = \sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n} \left(\frac{1}{L^n} \int_{\left[-\frac{L}{2},\frac{L}{2}\right]^n}(i k_j) \overline{e_k} u \,dx\right) e_k =\sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n}ik_j\hat{u_k} e_k. $
So we get by using the orthonormality of $(e_k)_{k \in \frac{2\pi}{L} \mathbb{Z}^n}$ wrt to the scalar product $(u,v) \mapsto \frac{1}{L^n}\int_{\left[-\frac{L}{2},\frac{L}{2}\right]^n}\overline{u}v$ the following:
$$\int_\Omega u^2 \,dx = \sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n}|\hat{u_k}|^2$$ and $$\int_\Omega |\nabla u|^2 \,dx = \sum_{j=1}^{n}\sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n}k_j^2|\hat{u_k}|^2 = \sum_{k \in \frac{2\pi}{L}\mathbb{Z}^n} |k|^2|\hat{u_k}|^2$$
How to finish this? Thanks. I'm having difficulty with the missing $|\hat{u_0}|$ term on the RHS.
I'll set $L=1$ without loss of generality without rescaling. Also, by a trivial translation, I'll rather use the cube: $(0,1)^n$. Since your function cancels at the boundary of the cube, it's better to use the orthonormal basis functions for $k\in(\mathbb N^*)^n$: $$ e_k = \prod_{i=1}^n\sqrt2\sin(\pi k_i x_i/L) $$ Decomposing: $$ u = \sum_{k\in(\mathbb N^*)^n} u_ke_k $$ You have: $$ ||u||_2^2 = \sum_{k\in(\mathbb N^*)^n} |u_k|^2 \\ ||\nabla u||_2^2 = \sum_{k\in(\mathbb N^*)^n} \pi^2 |k|^2|u_k|^2 \\ $$ because for any $j=1 ...n$: $$ e_k^j = \sqrt2\cos(\pi k_j x_j/L)\prod_{i=1, i\neq j}^n\sqrt2\sin(\pi k_i x_i/L) $$ are still orthonormal. Using $|k|^2\geq n$, you get: $$ ||u||^2_2\leq \frac{1}{n \pi^2}||\nabla u||_2^2 $$ which is not worse than your bound for $n\geq 4$. Actually, your bound is false for $n<4$, since my bound is optimal, being reached at $u=e_{1,...,1}$.
Intuitively, the prefactor is just the (inverse of) lowest eigenvalue of the Laplacian, and is reached when $u$ is the corresponding eigenvector.
If you really want to use your basis, then you should rather instead double the domain $(-1,1)^n$ by antisymmetry: $$ u(x_1,...,x_i,...x_n) = -u(x_1,...,-x_i,...x_n) $$ The antisymmetrization is where you use the assumption that the trace is zero. You then use Fourier series on this domain. The coefficients are odd, so the zero mode cancels and your estimation works. This is strictly equivalent to the first method.
Hope this helps.