maximum number of number of roots of $p(x) = 0$ is 
Let $p(x)=x^6+ax^5+bx^4+x^3+bx^2+ax+1.$ Given that $x=1$ is a root of $p$ but $x=-1$ is not, find the maximum number of number of roots of $p$.

My attempt:
$x=0$ in not a root of $p(x)=0.$ So
$$\left(x^3+\frac{1}{x^3}\right)+a\left(x^2+\frac{1}{x^2}\right)+b\left(x+\frac{1}{x}\right)+1=0$$
So
$$\displaystyle \left(x+\frac{1}{x}\right)^3-3\left(x+\frac{1}{x}\right)+a\left(x+\frac{1}{x}\right)^2-2+b\left(x+\frac{1}{x}\right)+1=0$$
So
$$ t^3+at^2+(b-3)t+1=0,$$
where
$$\left(x+\frac{1}{x}\right) = t \quad\text{ and }\quad |t|\geq 2.$$
Given $x=1$ is a root of $p$, $1+a+b+1+a+b+1=0$, so
$$\displaystyle a+b = -\frac{3}{2}$$
so
$$t^3+at^2+\left(-\frac{9}{2}-a\right)t+(1-2a) = 0.$$
$t=2$ is a root, so
$$(t-2)\bigg[t^2+(a+2)t+\left(\frac{2a-1}{2}\right)\bigg]=0,$$
So discriminant of above quadratic equation is $\displaystyle D = a^2+6>0$. So above equation has $2$ distinct real roots.
But I did not know how I use $x=-1$ is not a root. Could some help me to solve it? Thanks.

This answer assumes that you want to find the maximum number of the real roots of $p(x)$.
You already have
$$(t-2)\left(t^2+(a+2)t+a-\frac 12\right)=0$$
where $t=x+\frac 1x$ (which is correct though you have a typo in the part $a(x^2+\frac{1}{x^2})=a(x+\frac 1x)^2-2\color{red}{a}$).
Let $t_{\pm}$ where $t_-\lt t_+$ be the roots of $t^2+(a+2)t+a-\frac 12$ whose discriminant is $a^2+6\gt 0$.
Then, we have that
$$\text{$p(x)$ has six real roots if and only if $|t_-|\ge 2$ and $|t_+|\ge 2$}$$
Here, we have
$$\begin{align}|t_-|\ge 2&\iff \left|\frac{-a-2-\sqrt{a^2+6}}{2}\right|\ge 2\\\\&\iff \left|-a-2-\sqrt{a^2+6}\right|^2\ge 4^2\\\\&\iff (-a-2)^2+2(a+2)\sqrt{a^2+6}+a^2+6\ge 16\\\\&\iff (a+2)\sqrt{a^2+6}\ge -(a+3)(a-1)\tag2\end{align}$$


*

*For $a\gt 1$, $(2)$ holds since the LHS is non-negative and the RHS is negative.

*For $-3\le a\lt -2$, $(2)$ does not hold since the LHS is negative and the RHS is non-negative.

*For $-2\le a\le 1$, since the both sides are non-negative,$$(2)\iff (a+2)^2(a^2+6)\ge (-(a+3)(a-1))^2\iff \left(a+\frac 12\right)\left(a+\frac{5}{2}\right)\ge 0$$ 

*For $a\lt -3$, since the both side are negative,$$(2)\iff (-a-2)^2(a^2+6)\le (a+3)^2(a-1)^2\iff \left(a+\frac 12\right)\left(a+\frac{5}{2}\right)\le 0$$
So, we get
$$|t_-|\ge 2\iff (2)\iff a\ge -\frac 12\tag3$$
Similarly, we get
$$|t_+|\ge 2\iff a\le -\frac{5}{2}\tag4$$
Since there are no $a$ satisfying $(3)$ and $(4)$, we have that the number of the real roots of $p(x)$ is equal to or less than $4$. (Note that the number of the real roots of $p(x)$ is even since the number of the real solutions of $t=x+\frac 1x$ is even counted with multiplicity.)
By the way, for $a=-\frac 52$, we have
$$p(x)=(x-1)^4\left(\left(x+\frac 34\right)^2+\frac{7}{16}\right)$$
of which $x=-1$ is not a root.
The number of real roots of $p(x)$ for $a=-\frac 52$ is $4$.
Therefore, the maximum number of real roots of $p(x)$ is $\color{red}{4}$.
