Do you find this proof convincing? I must show that the function $f:\mathbb R^n \to \mathbb R$ defined as $ f(\mathbf x)=\sum_{j=1}^{k} \Vert \mathbf x -\mathbf{a}_j\Vert^2 $ for fixed $\mathbf a_1,...,\mathbf a_k \in\mathbb R^n$ has a global minimum. Here's my reasoning:
The function $f$ is continuous.
Pick $\delta \gt 0$, by definition closed balls (neighborhoods) are compact; so define $\bar{B}_n(\mathbf 0,n\delta) =\{ \mathbf x\in\mathbb R^n :\Vert\mathbf x\Vert \le n\delta\}$ for $n \in \mathbb N$, and define $f_n:\bar{B}_n(\mathbf 0,n\delta) \to \mathbb R$ as $f_n=\sum_{j=1}^{k} \Vert \mathbf x -\mathbf{a}_j\Vert^2$.
By the maximum/minimum value Theorem there is a $\mathbf y \in \bar{B}_n(\mathbf 0,n\delta) $ such that $f_n(\mathbf y)\le f_n(\mathbf x)$ for all $\mathbf x \in \bar{B}_n(\mathbf 0,n\delta)$. Call $f_n(\mathbf y)= y_n$.
For all $k \in \mathbb N$ we have: $y_{n+1} \le y_n$ because $\bar{B}_k(\mathbf 0,k\delta) \subset \bar{B}_{k+1}(\mathbf 0,(k+1)\delta)$, and $y_k \ge 0$ because $f_k(\mathbf x) \ge 0$ for all $\mathbf x$s in the domain; so the sequence $\{y_n\}$ is bounded below and non increasing, hence it converges, as $n \to \infty$, to a number $y$.
$y$ is the global minimum of $f(\mathbf x)=\sum_{j=1}^{k} \Vert \mathbf x -\mathbf{a}_j\Vert^2$.
I'm not so sure if I can claim that $y$ is indeed the global minimum of the function $f$
EDIT:
I don't seem to be able to complete the proof with my method, also I'm thinking that if I prove there is a closed ball big enough (with all the $\mathbf a_i$s in it) such that every element $\mathbf q$ outside the ball has its $f( \mathbf q)$ greater than the minimum inside then all the work above is superfluous.
People in the comments and in the answers have provided a more efficient strategy:
Let $f(\mathbf a_1)=\sum_{j=2}^{k} \Vert \mathbf a_1 - \mathbf a_j\Vert^2=M$, and define the closed ball $\bar{B}(\mathbf a_1,\sqrt{M})= \{ \mathbf x \in \mathbb R^n: \Vert \mathbf x - \mathbf a_1 \Vert \le \sqrt{M} \}$.
By the minimum value theorem there is some $\mathbf y$ in $\bar{B}(\mathbf a_1,\sqrt{M})$ such that $f(\mathbf y) \le f(\mathbf x)$ for all $\mathbf x$ in $\bar{B}(\mathbf a_1,\sqrt{M})$.
Pick any element $\mathbf q \notin \bar{B}(\mathbf a_1,\sqrt{M})$, which means that $0 \le \sqrt{M} \lt \Vert \mathbf q - \mathbf a_1 \Vert$ and thus $M \lt \Vert \mathbf q - \mathbf a_1 \Vert ^2$.
By definition we have $f(\mathbf y) \le f(\mathbf a_1) = M$, but it's also true that $\Vert \mathbf q - \mathbf a_1 \Vert \le f(\mathbf q)$. Therefore $f(\mathbf y) \lt f(\mathbf q)$ which completes the proof.
 A: The sequence $\{y_n\}$ does indeed converge to some real number $y$, but that does not guarantee that $y=f(x)$ for some $x\in\Bbb{R}^n$.
Instead, continue your argument by noting that the sequence $\{y_n\}$ is eventually constant; once all the $a_i$ are contained in the closed ball, the minimum will not decrease as the ball grows further.

Here's a sketch of a slightly slicker proof using the same idea:
Take any point $p\in\Bbb{R}^n$ and let $M:=f(p)$. Let $B:=\bar{B}(a_1,\sqrt{M})$ be the closed ball of radius $\sqrt{M}$ centered at $a_1$. Then for any point $q$ not in in $B$ we have
$$f(q)\geq||q-a_1||^2>M.$$
Now apply your minimum/maximum theorem to $B$ to get a global minimum.
A: Okay, so, alternative answer: for $M >> 1$ and a compact set $K \supset B_M(\mathbf{a}_1)$, you can see that in $K^c$ we have $f \geq \|\mathbf x -\mathbf a_1\|^2 \geq M$.  Now, since $f$ is smooth and
$$
\partial_j f = 2 \cdot \sum_i x_j-a_{ij} = 2\cdot \left(nx_j-\sum_i a_{ij}\right),
$$
the equation $\nabla f = 0$ has one only solution,
$$
x_j = \frac{1}{n}\sum_{i}a_{ij}.
$$
That is, the solution is the baricenter of the points, as expected:
$$
\mathbf b = \frac{1}{n}(\mathbf{a}_1+\cdots +\mathbf{a}_n).
$$
Let $c = f(\mathbf b)$. Now consider some $M > c$ and $K =B_M(\mathbf a_1)$ with $\mathbf b \in K$. Hence in $K^c$ we have $f \geq f(\mathbf{b})$.
Inside $K$ there must exist a minimum, and we have shown it is unique. This has to be a global minima, as we have seen that it is below every other value in $K^c$ (Edit: I have changed the compact set to be exactly $B_M(\mathbf a_1)$. This avoids the problem of the minimum being attained at $\partial K$)
