Here is a variational argument to prove that the maximizers do not change sign.

If $f \in H^1 (\mathbb{R}^N)$ be a maximizer, $u$ can be written as
$$
f = f_+ - f_-,
$$
with $f_+ \ne 0$ and $f_- \ne 0$.
Moreover
$$
\Vert f \Vert_{H^1}^2 = \Vert f_+ \Vert_{H^1}^2 + \Vert f_- \Vert_{H^1}^2
$$
and
$$
\Vert f \Vert_{L^p}^p= \Vert f_+ \Vert_{L^p}^p + \Vert f_- \Vert_{L^p}^p.
$$

We have thus

$$
\Vert f \Vert_{L^p}^2 = \frac{\Vert f_+\Vert_{L^p}^p}{\Vert f\Vert_{L^p}^p} \Vert f\Vert_{L^p}^2 + \frac{\Vert f_-\Vert_{L^p}^p}{\Vert f\Vert_{L^p}^p} \Vert f\Vert_{L^p}^2.
$$
By strict concavity of the map $t \in \mathbb{R} + \mapsto \vert t \vert^{\frac{2}{p}}$ and the optimality of (f),
$$
\Vert f \Vert_{L^p}^2
<\Vert f_+ \Vert_{L^p}^2 + \Vert f_- \Vert_{L^p}^2
\le \frac{\Vert f \Vert_{L^p}^2}{\Vert f \Vert_{H^1}^2}
\bigl(\Vert f_+ \Vert_{H^1}^2 + \Vert f_- \Vert_{H^1}^2 \bigr)
= \Vert f \Vert_{L^p}^p,
$$
which is a contradiction.

Essentially, the argument says that if $f$ changes sign then taking either $f_+$ or $f_-$ increases the quotient.

The argument extends to maximizers for embedding of $W^{1, q}$ with $1 \le q < \infty$.