The answer is 16n−8.
Assume that Pi=(xi,yi) for 1≤i≤4n+1. Set
P4n+2=(x4n+2,y4n+2)=P1=(x1,y1).
We will show that the sum
S=i=1∑4n+1(PiPi+1)2≥16n−8.
First, we show that this minimum can be obtained by setting
(P1,P2,…,P4n+1)=((2,0),(4,0),…,(n,0),(n−1,0),…,(1,0),(0,2),(0,4),…,(0,n),(0,n−1),…,(0,1),(−2,0),(−4,0),…,(−n,0),(−n+1,0),…,(−1,0),(0,−2),(0,−4),…,(0,−n),(0,−n+1),…,(0,−1),(0,0))
for n even, and
(P1,P2,…,P4n+1)=((1,0),(3,0),…,(n,0),(n−1,0),…,(2,0),(0,1),(0,3),…,(0,n),(0,n−1),…,(0,2),(−1,0),(−3,0),…,(−n,0),(−n+1,0),…,(−2,0),(0,−1),(0,−3),…,(0,−n),(0,−n+1),…,(0,−2),(0,0))
for n odd. This can be easily checked. For example, when n=2m is even, our construction shows that
S=4(i=1∑m−1(PiPi+1)2+(PmPm+1)2+i=m+1∑2m−1(PiPi+1)2)+3(P2mP2m+1)2+(P4nP4n+1)2+(P4n+1P1)2=4(4(m−1)+1+4(m−1))+3×5+1+4=32m−8=16n−8.
The exact same argument works when n is odd.
Note that
S=i=1∑4n+1[(xi−xi+1)2+(yi−yi+1)2].