An interesting problem about the ratio of distances for $n$ points Let $d$ be a fixed natural number, and let $\mathbb{R}^d$ be a fixed Euclidean space. 
(In familiar case, it could be $\mathbb{R}^1$, $\mathbb{R}^2$, or $\mathbb{R}^3$.)
For every $n \in \mathbb{N}$, let $f(n)$ be the supremum of the value of
$$\sum_{i=1}^n \frac{{\overline{X_i X_{i+2} }}^2}{{\overline{X_i X_{i+1}}}^2},$$
where $X_1, \ldots, X_n$ are arbitrary points in $\mathbb{R}^d$ 
(except when the denominator equals zero.)
($X_{n+1} = X_1$, and $X_{n+2} = X_2$.)
I found that $f(5) = \big(\frac{1 + \sqrt{5}}{2}\big)^2$. 
[cf. Theorem 2.1.] (https://dx.doi.org/10.7153/jmi-2018-12-90)
And if $X_1, \ldots, X_n$ are the points of regular $n$-gon, 
then the value of ratio can be found easily by 
$ {\big( \frac{ \sin \frac{2\pi}{n} }{ \sin \frac{\pi}{n}  } \big)}^2 $.
It might be $f(n)$ or not in general. (In fact, $f(5)$ is the exact that value.)
First Question. Can we explicitly find $f(n)$ for every $n \in \mathbb{N}$?
Second Question. If so, then can we find the equality condition in each case?
Thank you for your attention. 
 A: For any positive integer $n$, let $[n]$ be a short hand of $\{1,\ldots,n\}$.
For any $i \in [n]$, let $$\vec{Y}_i = \vec{X}_{i+1} - \vec{X}_i = (y_{i1},\ldots,y_{id}) \in \mathbb{R}^d$$ 
Extend this definition to other $i$ by periodicity. i.e. $\vec{Y}_{n+1} = \vec{Y}_1$ and $y_{n+1,j} = y_{1j}$, etc.
The problem at hand is equivalent to finding the supremum of
$$\frac{\sum_{i=1}^n |\vec{Y}_i + \vec{Y}_{i+1}|^2}{\sum_{i=1}^n |\vec{Y}_i|^2}
= \frac{\sum_{j=1}^d\sum_{i=1}^n (y_{ij} + y_{i+1,j})^2}{\sum_{j=1}^d\sum_{i=1}^n y_{ij}^2}
\tag{*1}$$
for $\vec{Y}_1, \ldots, \vec{Y}_n \in \mathbb{R}^d$ subject to the constraint $\sum_{i=1}^n \vec{Y}_i = \vec{0}$.
Let $\Lambda$ be the supremum of the expression 
$$\frac{\sum_{i=1}^n (y_i + y_{i+1})^2}{\sum_{i=1}^n y_i^2}\tag{*2}$$
for $y_1 = y_{n+1}, y_2 \ldots, y_n \in \mathbb{R}$ subject to the constraint
$\sum_{i=1}^n y_i = 0$. Notice 
$$\sum_{i=1}^n \vec{Y}_i = \vec{0} \implies \sum_{i=1}^n y_{ij} = 0
\quad\text{ for all }\quad j\in [d]$$
RHS of $(*1)$ is bounded from above by
$\displaystyle\;\frac{\sum_{j=1}^d (\Lambda \sum_{i=1}^n y_{ij}^2)}{\sum_{j=1}^d \sum_{i=1}^n y_{ij}^2} = \Lambda$. This implies $\sup(*1) \le \Lambda$.
In $(*1)$, if we restrict $\vec{Y}_i$ to those $\in \mathbb{R} \times \{0\}^{n-1}$ ( i.e. $y_{ij} = 0$ unless $j = i$ ), the supremum cannot increase. This implies $\Lambda \le \sup(*1)$ and hence
$$\sup(*1) = \Lambda = \sup(*2)$$
Notice expression $(*2)$ is homogeneous in $y_i$ and so does the constraint $\sum_{i=1}^n y_i = 0$. We find
$$\Lambda = \sup \left\{ \sum_{i=1}^n (y_i + y_{i+1})^2
: \sum_{i=1}^n y_i^2 = 1 \land \sum_{i=1}^n y_i = 0
\right\}$$
Rephrase everything in terms of matrices, let


*

*$y$ be the $n\times 1$ column vector $(y_1,\ldots,y_n)^T$.

*$u$ be the $n\times 1$ column vector with all entries $1$.

*$A = (a_{ij})$ be the $n\times n$ matrix with $a_{ij} = \begin{cases} 2, &i = j\\1,& i - j \equiv \pm 1 \pmod n\\ 0,&\text{ otherwise }\end{cases}$
We have
$$\Lambda = \sup_{y} \left\{ y^T A y : y^T y = 1, y^T u = 0 \right\}$$
$A$ is a real symmetric circulant matrix, its eigenvalues and eigenvectors has the form
$$\begin{cases}
\lambda_j &= 2(1+\cos\frac{2\pi(j-1)}{n})\\
v_j &= \frac{1}{\sqrt{n}}(1, w_j, w_j^2, \ldots, w_j^{n-1})
\end{cases}
\quad\text{ for }j \in [n],\; \omega_j = e^{i\frac{2\pi(j-1)}{n}}$$
$\lambda_1 = 4$ is its largest eigenvalue. Since $u$ is proportional to corresponding eigenvector $v_1$, by minimax principle of Hermitian matrices, $\Lambda$ equals to the $2^{nd}$ largest eigenvalue of $A$. i.e.
$$f(n) = \Lambda = \lambda_2 = \lambda_n = 2\left(1+ \cos\frac{2\pi}{n}\right)$$
For a $y \in \mathbb{R}^d$ to attain this ratio, it needs to be an eigenvector with eigenvalue $\lambda_2 = \lambda_n$. i.e. $y$ is a complex linear combination of $v_2$ and $v_n$ so that all its components are real. The end result is $y$ has following form:
$$y = \alpha\left(\cos\beta,\cos(\frac{2\pi}{n} + \beta),
\ldots,\cos(\frac{2\pi(n-1)}{n} + \beta)\right)$$
for suitably chosen real constants $\alpha, \beta$.
One can use this to construct $\vec{Y}_i$ and hence $\vec{X}_i$ which attain the equalities mentioned in second question.
Update
As an illustration what minimax principle implies,  consider what happens at $n = 6$. We have 
$$\lambda_1 > \lambda_2 = \lambda_6 > \lambda_3 = \lambda_5 > \lambda_4$$ and components of $v_2, v_3$ are complex conjugates of components $v_6, v_5$ respectively. 
When one expand a real vector $y$ as a linear combination of $v_j$:
$\displaystyle\;y = \sum_{j=1}^n \alpha_j v_j\;$, the coefficients $\alpha_j$ need to satisfy:
$$\alpha_1 = \bar{\alpha}_1,
\alpha_2 = \bar{\alpha}_6, \alpha_3 = \bar{\alpha}_5, \alpha_4 = \bar{\alpha}_4$$
By a change of variables,
$$(x_1,x_2,x_3,x_4,x_5,x_6) = (\alpha_1,\,\sqrt{2}\Re \alpha_2,\,\sqrt{2}\Re \alpha_3,\,\alpha_4,\,\sqrt{2}\Im\alpha_3,\,\sqrt{2}\Im\alpha_2)$$
the problem becomes one in finding the supremum of 
$$u^T A u = \sum_{i=1}^6 \lambda_i |\alpha_i|^2 = \lambda_1 x_1^2 + \lambda_2 (x_2^2 + x_6^2) + \lambda_3 (x_3^2 + x_5^2) + \lambda_4 x_4^2$$
subject to constraints $\;\alpha_1 = x_1 = 0\;$ and $\;\sum\limits_{i=2}^6 |\alpha_i|^2 = \sum\limits_{i=2}^6 x_i^2 = 1$. It is clear we can completely forget $x_1$ and the supremum equals to the largest number among the eigenvalues $\lambda_2,\lambda_3,\ldots$. i.e.  the second largest eigenvalue of $A$.
