Let $r$ be the largest eigenvalue of our $n\times n$ matrix $A$. Then $r>0$, is associated to a $>0$ eigenvector and $(n-1)a+\min_i(x_i)\leq r\leq (n-1)a+\max_i(x_i)$.
If, for example $\min_i(x_i)=x_1,max_i(x_i)=x_n$, then a necessary condition for $r=trace(A)$ is
$x_1+\cdots x_{n-1}\leq (n-1)a\leq x_2+\cdots +x_n$.
Of course, if $a=x_1=\cdots=x_n$, then $r=trace(A)$.
EDIT 1. An example
Let $A=\begin{pmatrix}1&a&a\\a&2&a\\a&a&3\end{pmatrix}$ where $3/2\leq a\leq 5/2$. If $\chi_A$ is the characteristic polynomial of $A$, then $\chi_A(trace(A))=-2a³-12a²+60=0$ for $a\approx 1.94338$.
Here, we are not interested in the hypothesis $\det(A)=0$.
EDIT 2. Now we consider also the condition $\det(A)=0$. By homogenization, we may assume $a=1$. Since $A$ is real symmetric, $A$ is diagonalizable and its eigenvalues are real.
$n=2$. The NS condition is $x_1x_2=1$.
$n=3$. Since $spectrum(A)=\{0,0,trace(A)\}$, one has $rank(A)=1$ and necessarily $x_1=x_2=x_3=1$.
$n=4$. $spectrum(A)=\{\alpha,-\alpha,0,trace(A)\}$. That follows is a solution, in a neighborhood of $(1,\cdots,1)$ s.t. $\sigma_{3}\not= 4$.
$x_1\approx 1.0031092671785911483799797182382559149854506473873$
$x_2\approx 1.0698119384582623856800661089697199349941153438922$
$x_3\approx 0.93098479177751996117373383813583484579257578850415$
$x_4\approx .99689878083018837746093466133628743171083298298820$.