First sort your [multi]set: $\{1, 2, 5, 5, 7, 100\}$. The number you want is $5$. The sum is $4 + 3 + 0 + 0 + 2 + 95 = 104.$
Proof: suppose you have another number $n \neq 5$.
Note that for any number $x$, $|x - a| + |x - b| \ge |a - b|$ by the triangle inequality, where equality holds if and only if $x$ is between $a$ and $b$ (inclusive).
Hence, it must hold that the sum of its distances to the two $5$s, i.e. $$|n - 5| + |n - 5| \ge |5 - 5| + |5 - 5| = 0.$$ Similarly, $$|n - 2| + |n - 7| \ge |5 - 2| + |5 - 7| = 5,$$
$$|n - 1| + |n - 100| \ge |5 - 1| + |5 - 100| = 99.$$
You can't have the total distance any lower.
Q.E.D.
In general, first sort your set, then any number between (including) the middle two numbers will do. For example, for set ${1, 2, 3, 4, 5, 6}$, any $x$ such that $3 \le x \le 4$ does.