The optimal shape is the regular $n$-gon and all its affine images.

I am going to optimize the ratio
$$
 \frac{\sum_{i<j} |P_iP_j|^2}{\sum_i|P_iP_{i+1}|^2}
$$
which differs from $A_n$ by 1. For the regular $n$-gon this ratio equals
$$
 \frac{n}{2(1-\cos\frac{2\pi}n)} .
$$
Let us prove that this is the maximum.

The maximum ratio equals the maximum $\lambda\in\mathbb R$ such that the quadratic form
$$
 P\mapsto Q_\lambda(P) := \sum |P_iP_j|^2-\lambda\sum|P_iP_{i+1}|^2
$$
is nonnegative definite. Here $P$ denotes a polygon $P_1\dots P_n$ regarded as a point in $\mathbb R^{2n}$, so $Q_\lambda$ is a quadratic form in $\mathbb R^{2n}$. If $\lambda$ is the maximum and $P$ is an optimal polygon, then $Q_\lambda(P)=0$.

By the Pythagorean theorem, the coordinate expression for $Q_\lambda(P)$ splits into 2 independent summands: one for $x$-coordinates of the vertices and a similar one for $y$-coordinates. Since the form is nonnegative on all configurations of points, it is also nonnegatve on the projections to $x$- and $y$-lines, and both summands must be zero separately.

Thus we have reduced the problem to the 1-dimensional case. It remains to solve the similar problem for the from $Q_\lambda$ in $\mathbb R^n$:
$$
 Q_\lambda(x) = \sum (x_i-x_j)^2-\lambda\sum(x_i-x_{i+1})^2
$$
where $x=(x_1,\dots,x_n)\in\mathbb R^n$. By the way, this reduction also shows that, whatever the optimal shape is, it comes with all its affine images.

Now assume that $\lambda$ is the maximum ratio and $x=(x_i)$ is an optimal configuration on the line. Differentiating $Q_\lambda(x)$ with respect to $x_i$ yields
$$
 2n(x_i-a) -2\lambda(2x_i-x_{i-1}-x_{i+1})
$$
where $a$ is the arithmetic mean of $x_1,\dots,x_n$. The derivative must be zero, and by translation we may assume that $a=0$. This gives us a linear recurrence equation
$$
 x_{i+1}=-x_{i-1}+(\tfrac{n}{\lambda}-2)x_i .
$$
The solution must be $n$-periodic, so it is a linear combination of two geometric progressions whose ratios are two conjugate $n$th roots of unity. In other words, we have
$$
 x_k = A \cos k\varphi + B\sin k\varphi
$$
for some real constants $A$ and $B$, where $\varphi$ is a multiple of $\frac{2\pi}n$. (Notation $i$ is changed to $k$ to prevent confusion with complex numbers.) Then
$$
 \lambda = \frac{n}{2(1-\cos\varphi)} .
$$
Checking the condition $Q_\lambda(x)=0$ leaves the only possibility $\varphi=\frac{2\pi}n$ (for larger multiples, the quantity is strictly positive).

Thus the maximum ratio equals $\frac{n}{2(1-\cos\frac{2\pi}n)}$ and the  optimal polygons are those whose $x$- and $y$-coordinates are sequences of the above form. These are precisely affine images of a regular $n$-gon. The solution is the same in all dimensions, not only in the plane.