Prove that the total distance is minimised (when travelling across the longest path)
Let $x$ be a vertex of your tree and consider a shortest route that visits every vertex and returns to&nbsp;$x$. It's easy to see that, regardless of the choice of&nbsp;$x$, any minimal route walks along every edge exactly twice: it must use each edge at least twice, or it wouldn't be able to get back to&nbsp;$x$; if it uses an edge more than twice, you can rearrange to avoid the backtracking.  Therefore, all such minimal routes have the same length, regardless of the choice of&nbsp;$x$.  Call that length&nbsp;$L$ (which is $2(n-1)$ if the tree is unweighted and there are $n$&nbsp;vertices, but this isn't important).

Now, given a minimal route from&nbsp;$x$, let $y$ be the last vertex to be visited for the first time (i.e., the vertex which, when you first visit it, you say "Aha, now I've been to every vertex!").  The minimal route visits every vertex on its way from $x$ to&nbsp;$y$, and then returns immediately to&nbsp;$x$ along the unique shortest path.  Let $L_{xy}$ be the length of the walk taken from $x$ to&nbsp;$y$.  We know that $L=L_{xy}+d(x,y)$, and $L$ and $d(x,y)$ don't depend on how we got to&nbsp;$y$, so $L_{x,y}$ also doesn't depend on the route and we can say that $L_{xy}$ is the length of any minimal walk from $x$ to&nbsp;$y$ that visits every vertex.

The vertex&nbsp;$y$ must be a leaf: if it wasn't, when you first visited&nbsp;$y$, you wouldn't have visited any of the vertices "beyond" it.  Further, for any leaf&nbsp;$z$ of the tree, there are minimal routes from&nbsp;$x$ back to itself such that $z$&nbsp;is the last vertex visited for the first time: let $v_1v_2\dots v_t$ be the path from $v_1=x$ to $z=v_t$ and don't go to&nbsp;$v_{i+1}$ until you've already visited every other descendant of&nbsp;$v_i$.

So, to get the longest walk from&nbsp;$x$ that visits every vertex, pick a route whose&nbsp;$y$ is the leaf at greatest distance from&nbsp;$x$.  None of the above depends on which vertex was chosen as&nbsp;$x$, $L_{xy}=L-d(x,y)$ is minimized by choosing $x$ and&nbsp;$y$ to be the vertices at greatest possible distance in the tree, which are both leaves.