We want to maximize $\sum k_i a_i$ under the constraint that $(k_1,\ldots,k_n)$ belongs to an actually possible route. As a consequence of "possible route" we know that $k_i\in\{-2,0,2\}$ and $\sum k_i=0$.
So let
$$S=\bigl\{\,(k_1,\ldots,k_n)\bigm| \forall i\colon k_i\in\{-2,0,2\}\text{ and }\textstyle\sum_ik_i=0\,\bigr\} $$
Now Calvin Lin suggest a specific such sequence $\bar{\mathbf k}=(\bar k_1,\ldots,\bar k_n)\in S$, namely
$$ \bar k_i=\begin{cases}-2,&1\le a_i\le \lfloor n/2\rfloor\\
\hphantom{-}0,&\lfloor n/2\rfloor<a_i<\lceil(n+1)/2\rceil\\
+2,&\lceil n/2\rceil+1\le a_i\le n
\end{cases}$$
that is, first $\lfloor n/2\rfloor$ terms $=-2$, then possibly a $0$ (for odd $n$), then $\lfloor n/2\rfloor$ terms $=+2$. More importantly, he also shows that this sequence $k_i$ indeed belongs to a possible route.
Proposition. Let $\mathbf k\in S$ be any sequence with $\mathbf k\ne \bar{\mathbf k}$. Then there exists $\mathbf k'\in S$ with $\sum k'_ia_i>\sum k_ia_i$.
Proof. As $\mathbf k\ne \bar{\mathbf k}$, there must exist an index where the two sequences differ. As $\sum k_i=\sum\bar k_i=0$, there must in fact be indices $u,v$ such that $k_u>\bar k_u$ and $k_v<\bar k_v$.
This is only possible if $a_v>\lfloor n/2\rfloor$ and $a_u<\lceil n/2\rceil+1$, at any rate $a_u<a_v$. Let $$k'_i=\begin{cases}k_i-2,&i=u\\k_i+2,&i=v\\k_i,&\text{otherwise}\end{cases} $$
Then $\mathbf k'\in S$. Also
$$\sum k'_ia_i-\sum k_ia_i=\sum (k'_i-k_i)a_i = -2a_u+2a_v=2(a_v-a_u)>0 $$
$\square$
We conclude that the optimal element of the (finite) set $S$ is $\bar{\mathbf k}$.
To compute $\sum \bar k_ia_i$, we can use that the $a_i$ are a pemutation of $1,\ldots,n$:
$$ \begin{align}\sum \bar k_ia_i&=\sum_{j=1}^{\lfloor n/2\rfloor}(-2)j+\sum_{j=\lceil n/2\rceil+1}^n2j\\&=\sum_{j=1}^{\lfloor n/2\rfloor}(-2)j+\sum_{j=1}^{\lfloor n/2\rfloor}2(j+\lceil n/2\rceil)\\
&=\sum_{j=1}^{\lfloor n/2\rfloor}2\lceil n/2\rceil\\
&=2\lfloor n/2\rfloor\lceil n/2\rceil\end{align}$$