Length is a primitive notion - we have to have some definition before we can talk about it. But if you assume that $|| \cdot ||$ already exists in $\mathbb{R}^n$, and make the reasonable assumptions
1) that it obeys the Pythagorean theorem $||x||^2 + ||y||^2 = ||x+y||^2$ for $x,y$ orthogonal
2) that if $$e_i := (0, 0, \ldots, 0, 1, 0, \ldots, 0)$$ with a $1$ in the $i$-th place and $0$ elsewhere then $$||e_i|| = 1,$$
3) that $$||\lambda x|| = \lambda ||x||$$ for any scalar $\lambda \geq 0$
then you can derive the formula for it. These are all properties of $|| \cdot ||$ in $\mathbb{R}^k$ for $ k \leq 3$, so it is natural to assume they should hold in $\mathbb{R}^n$.
You need not even define orthogonality in general - it's enough to assume that the $e_i$ are orthogonal. Note that (1) extends to any number of summands, e.g., $$||x+y+z||^2 = ||x + y||^2 + ||z||^2 = ||x||^2 + ||y||^2 + ||z||^2$$ if $x,y,z$ are orthogonal, or in general, $$||\sum_{i=1}^n v_i||^2 = \sum_{i=1}^n ||v_i||^2$$ when $v_1, \ldots, v_n$ are orthogonal - I'll let you see how to prove this with induction.
Note that for any $(x_1, \ldots, x_n) \in \mathbb{R}^n$, you get $$(x_1, \ldots, x_n) = x_1 \cdot (1, 0, \ldots, 0) + x_2 \cdot ( 0,1, \ldots, 0) + \ldots + x_n \cdot (0, \ldots, 0, 1)= \sum_{i=1}^n x_i e_i$$
and the summands $x_i e_i$ are orthogonal. So
$$||(x_1, \ldots, x_n)||^2 = ||\sum_{i=1}^n x_i e_i|| = \sum_{i=1}^n ||x_i e_i||^2 = \sum_{i=1}^n x_i^2 ||e_i||^2 = \sum_{i=1}^n x_i^2.$$
See also Pythagorean theorem in higher dimensions?