Let $ n$ be a given positive integer. In the coordinate set, consider the set of points $ \{P_{1},P_{2},...,P_{4n+1}\}=\{(x,y)|x,y\in \mathbb{Z}, xy=0, |x|\le n, |y|\le n\}.$
Determine the minimum of $ (P_{1}P_{2})^{2} + (P_{2}P_{3})^{2} +...+ (P_{4n}P_{4n+1})^{2} + (P_{4n+1}P_{1})^{2}.$
$16 n - 8 $ seems the least possible.
For the corresponding problem with the lattice points of the axis in $\mathbb R^d$, i.e. \[ \{P_{1},P_{2},...,P_{2dn+1}\}=\Bigl\{(x_1,...,x_d)\in\mathbb{Z}^d\ \biggl| \ \sum_{i<j}x_i^2x_j^2=0, |x_i|\le n\ \forall i\Bigr\}, \]I think the minimum is $4d(2n-1)$ for $d\ge2$ and $8n-2$ for $d=1$.
Indeed, $16n-8$ is the minimum value.
For $n = 1$ it's trivial to check, so WLOG assume that $n \ge 2.$
Let $S$ be the set of $4n+1$ points described in the problem.
For $n = 2$, if we let $P_1, P_2, \cdots, P_9$ be $(2, 0), (1, 0), (0, -2), (0, -1), (-2, 0), (-1, 0), (0, 1), (0, 2), (0, 0)$ then we obtain the desired value of $16 \cdot 2 - 8 = 24$ for $\sum (P_iP_{i+1})^2.$
For $n = 3$, we can let $P_1, P_2, \cdots, P_{13}$ be $(3, 0), (1, 0), (0, 2), (0, 3), (0, 1), (-2, 0), (-3, 0), (-1, 0), (0, 0), (0, -2), (0, -3), (0, -1), (2, 0)$ in order to obtain the desired value of $16 \cdot 3 - 8 = 40$ for $\sum (P_iP_{i+1})^2.$
Assume now that $n > 3.$ We will describe a way to connect pairs of points in $S$ such that the resulting edges comprise a $(4n+1)-$cycle with the sum of squares of lengths of edges being $16n-8$. This would clearly upper bound our answer by $16n-8.$ Start by adding edges between the following $8$ pairs of vertices:
$$((0, n), (0, n-1)), ((0, n), (0, n-2)), ((n, 0), (n-1, 0)), ((n,0), (n-2, 0)), ((0, -n), (0, -(n-1))), ((0, -n), (0, -(n-2))), ((-n, 0), (-(n-1), 0)), ((-n, 0), (-(n-2), 0)).$$
The sums of the squares of the lengths of these edges is $20.$
Now, for each $3 \le i < n,$ add edges between the following $4$ pairs of vertices:
$$((0, i), (0, i-2)), ((i, 0), (i-2, 0)), ((0, -i), (0, -(i-2))), ((-i, 0), (-(i-2), 0)).$$
The sums of squares of the lengths of these edges is $16$, and so our total sum so far is $20 + (n-3) \cdot 16 = 16n - 28.$
Finally, add edges between the following $5$ pairs of vertices:
$$((-2, 0), (0, 1)), ((0, 2), (1, 0)), ((2, 0), (0, -1)), ((0, -2), (0, 0)), ((0, 0), (-1, 0)).$$
The sum of the squares of these edges is $5+5+5+4+1 = 20$, and so our grand total is $16n-28 + 20 = 16n-8,$ as desired. It's not hard to see that the $4n+1$ edges we've now drawn indeed comprise a $(4n+1)-$cycle on the vertices of $S$, and so the construction is complete.
We will show that $(P_1P_2)^2 + (P_2P_3)^2 + \cdots + (P_{4n}P_{4n+1})^2 + (P_{4n+1}P_1)^2 \ge 16n-8$ for an arbitrary labeling $P_1, P_2, \cdots, P_{4n+1}$ of the points of $S.$
Let $x_1, x_2, \cdots, x_{4n+1}$ be the $x-$coordinates of $P_1, P_2, \cdots, P_{4n+1}.$ We will show that:
$$\sum_{i=1}^{4n+1} (x_i - x_{i+1})^2 \ge 8n-4, \qquad (1)$$where $4n+2 = 1$ here. This, together with an analogous result for the $y-$coordinates, would solve the problem with the Pythagorean Theorem.
So let's just show this. Let $a_1, a_2, \cdots, a_t$ be the sequence which is just $x_1, x_2, \cdots, x_{4n+1}$ after compressing blocks of $0$'s into a single $0$. For example, in the construction for $n = 3$ above, $(x_1, x_2, \cdots, x_{13}) = (3, 1, 0, 0, 0, -2, -3, -1, 0, 0, 0, 0, 2)$ and $(a_1, a_2, \cdots, a_{13}) = (3, 1, 0, -2, -3, -1, 0, 2).$ Observe that every nonzero number appears in the sequence $a_1, a_2, \cdots, a_t$ exactly one time. Now, WLOG assume that $a_1 = -n$ and $a_b = n$, for some $2 \le b \le t.$ Notice that $\sum_{i=1}^{b-1} (a_{i+1}-a_i)^2$ is minimized when $a_1, a_2, \cdots, a_b$ is nondecreasing. Hence, for the purposes of proving $(1)$, we can assume that $a_1, a_2, \cdots, a_b$ is strictly increasing. Analogously, we may assume that $a_b, a_{b+1}, \cdots, a_t, a_1$ is strictly decreasing. In this way, we know that $0$ appears at most two times among the $a_i$'s (once among $\{a_2, a_3, \cdots, a_{b-1}\}$ and once among $\{a_{b+1}, a_{b+2}, \cdots, a_t\}$). Therefore, as all other values appear exactly once, we obtain that $t \in \{2n+1, 2n+2\}.$ From the Cauchy-Schwarz Inequality, we know that
$$\sum_{i=1}^{b-1} (a_{i+1} - a_i)^2 \ge (\sum_{i=1}^{b-1} (a_{i+1}-a_i))^2/(b-1) = \frac{4n^2}{b-1}.$$
Analogously we get that
$$\sum_{i = b}^{t} (a_{t+1}-a_t)^2 \ge \frac{4n^2}{t+1-b}.$$
Summing the above two inequalities, we obtain
$$\sum_{i = 1}^{t} (a_{i+1} - a_i)^2 \ge \frac{4n^2}{b-1} + \frac{4n^2}{t+1-b} = \frac{4n^2t}{(b-1)(t+1-b)} \ge \frac{4n^2t}{\frac{t^2}{4}} = \frac{16n^2}{t}.$$
If $t = 2n+1$, then we have $\frac{16n^2}{t} = \frac{16n^2}{2n+1} > 8n-4,$ and so we're done. Else, suppose that $t = 2n+2.$
Then, we know that there exists $1 < c < b$ with $a_c = 0$ and $b < d \le t$ with $a_d = 0.$
Lemma. For any permutation $\sigma$ of $[n]$, we have $\sum_{i = 1}^{n} (\sigma(i) - \sigma(i+1))^2 \ge 4n-6.$
Proof. We proceed by induction on $n$. For $n = 2, 3$, the result is easily verified. Suppose that the lemma holds for $n = k.$ When $n =k+1,$ let $a, b$ be the two numbers on either side of $k+1$ in the permutation. In other words, if $\sigma(i) = k+1,$ then $\{a, b\} = \{\sigma(i-1), \sigma(i+1)\}$ with indices modulo $k+1.$ Consider the effect of removing $k+1$ from the permutation entirely. Then, from the inductive hypothesis, it suffices only to show that $(k+1-a)^2 + (k+1-b)^2 - (a-b)^2 \ge 4.$ Notice that $c = k+1-a$ and $d = k+1-b$ are distinct positive integers, and so therefore $c^2 + d^2 - (c-d)^2 = 2cd \ge 2 \cdot 1 \cdot 2 = 4,$ as desired.
$\blacksquare$
Now, apply the lemma on the permutations $(a_c+1, a_{c+1}+1\cdots, a_{d-1}+1)$ and $(a_d+n+1, a_{d+1}+n+1, \cdots, a_t+n+1, a_1+n+1, \cdots, a_{b-1}+n+1)$ of $[n+1].$ Summing the two resulting expressions and using that $a_c = a_d = 0$ gives us that:
$$\sum_{i=1}^{t} (a_{i+1}-a_i)^2 \ge 4(n+1)-6 + 4(n+1)-6 = 8n-4,$$
as desired.
$\square$