$f:\Bbb R\to\Bbb R\,,\;$ where $\,f(x)=|x|+|ax+1|\,.$
The function $\,f\,$ has a vertical axis of symmetry if and only if there exists $\,p\in\Bbb R\,$ such that $\,f(p+x)=f(p-x)\,$ for any $\, x\in\Bbb R\;,\;$ that is ,
$|p\!+\!x|+|a(p\!+\!x)\!+\!1|=|p\!-\!x|+|a(p\!-\!x)\!+\!1|\;,\;\;\forall x\in\Bbb R\;,$
$|p\!+\!x|\!+\!|ap\!+\!1\!+\!ax|=|p\!-\!x|\!+\!|ap\!+\!1\!-\!ax|\;,\;\;\forall x\in\Bbb R\,.\;\;\color{blue}{(*)}$
From $\,(*)\,,\,$ for $\;x=p\,,\;x=\dfrac p2\;$ and $\;x=2p\,,\;$ we get respectively :
$\begin{cases}|2p|+|2ap+1|=1\\[5pt]\left|\dfrac{3p}2\right|+\left|\dfrac{3ap}2+1\right|=\left|\dfrac p2\right|+\left|\dfrac{ap}2+1\right|\\[5pt]|3p|+|3ap+1|=|p|+|1-ap|\end{cases}$
that is ,
$\begin{cases}|2p|+|2ap+1|=1\qquad\color{blue}{(1)}\\[5pt]|2p|+|3ap+2|=|ap+2|\qquad\color{blue}{(2)}\\[5pt]|2p|+|3ap+1|=|1-ap|\qquad\color{blue}{(3)}\end{cases}$
From $\,(1)\,,\,$ it follows that $\;|2ap+1|\leqslant1\,,\,$ hence ,
$-1\leqslant ap\leqslant0\;.$
Moreover, if $\,ap=-1\,,\,$ from $\,(1)\,,\,$ we would get $\,p=0\,$ which would lead to a contradiction indeed it would result that $\,ap=0=-1\,,$ therefore ,
$-1<ap\leqslant0\;.$
Since $\;-1<ap\leqslant0\;$ and $\; |2p|=1-|2ap+1|\;,\;$ the equalities $\,(2)\,$ and $\,(3)\,$ will become
$\begin{cases}1-|2ap+1|+|3ap+2|=ap+2\qquad\color{blue}{(2’)}\\[5pt]1-|2ap+1|+|3ap+1|=1-ap\qquad\color{blue}{(3’)}\end{cases}$
If $\;-1<ap<-\dfrac12\;,\;$ the equality $\,(2’)\,$ leads to a contradiction, indeed, from $\,(2’)\,$ we get that ,
$1+2ap+1+|3ap+2|=ap+2\;\;,$
$|3ap+2|=-ap\;\;,$
$9(ap)^2+12(ap)+4=(ap)^2\;\;,$
$8(ap)^2+12(ap)+4=0\;\;,$
$2(ap)^2+3(ap)+1=0\;\;,$
$ap=\dfrac{-3\pm\sqrt{9-8}}4=\dfrac{-3\pm1}4\;,\;$ that is ,
$ap=-1\;\lor\;ap=-\dfrac12$
which is a contradiction if $\;-1<ap<-\dfrac12\,.$
Consequently, it results that
$-\dfrac12\leqslant ap\leqslant0\;.$
Since $\;-\dfrac12\leqslant ap\leqslant0\;,\;$ from the equality $\,(3’)\,$ we get that ,
$1-2ap-1+|3ap+1|=1-ap\;\;,$
$|3ap+1|=ap+1\;\;,$
$9(ap)^2+6(ap)+1=(ap)^2+2(ap)+1\;\;,$
$8(ap)^2+4(ap)=0\;\;,$
$4(ap)\big[2(ap)+1\big]=0\;\;,$
$ap=0\;\lor\;ap=-\dfrac12\;.$
In this way, we have proved that the equality $\,(*)\,$ implies that
$ap=0\;\lor\;ap=-\dfrac12\;.\quad\color{blue}{(4)}$
Case $\;ap=0\,:$
from $\,(1)\,,\,$ it follows that $\,p=0\,,$ and from $\,(*)\,$ we get that
$|x|+|1+ax|=|x|+|1-ax|\;,\;\;\forall x\in\Bbb R\;,$
$|1+ax|=|1-ax|\;,\;\;\forall x\in\Bbb R\;,\quad\color{blue}{(**)}$
which implies $\;a=0\;,\;$ indeed if $\;a\neq0\;,\;$ from $\,(**)\,$ for $\,x=\dfrac1a\,,\,$ we would get the contradiction $\;2=0\;.$
Case $\;ap=-\dfrac12\,:$
from $\,(1)\,,\,$ it follows that $\,p=\pm\dfrac12\,,$ and consequently $\;a=\mp1\;.$
Therefore, the values of $\,a\,$ such that the function $\,f\,$ has a vertical axis of symmetry, are the following ones :
$a=0\;\;,\;\;a=-1\;\;,\;\;a=1\;.$
If $\;a=0\;,\;$ then the equation of the vertical axis of symmetry of the function $\,f\,$ is $\;x=0\;$ (indeed in this case $\,p=0$).
If $\;a=-1\;,\;$ then the equation of the vertical axis of symmetry of the function $\,f\,$ is $\;x=\dfrac12\;$ (indeed in this case $\,p=\frac12$).
If $\;a=1\;,\;$ then the equation of the vertical axis of symmetry of the function $\,f\,$ is $\;x=-\dfrac12\;$ (indeed in this case $\,p=-\frac12$).