I can get it when $x \in \mathbb R$, but I cannot understand why
$$\sup\{a^Tx \mid \|x\|_2 \le 1 \} = \| a \|_2$$ when $x \in \mathbb R^n$. To my understanding, this problem can be transformed into a Second Order Cone Programming (SOCP) problem:
$$\begin{array}{ll} \text{minimize} & -a^T x\\ \text{subject to} & \| x \|_2 \le 1\end{array}$$
By Cauchy-Schwartz inequality, you have
$$a^Tx\leq \|a\|_2\|x\|_2\leq \|a\|_2.$$ Now note that for $x=\frac{1}{\|a\|_2}a,$ the equality holds.
You could also use Lagrange multipliers to find the solution, and it is a general method, but this way seems faster.