I have managed to do part A but part B's starting point is confusing. If the question stated find the sum of the distance from X to the vertices of the polygon the rest of the question is fine.
But why does mean the sum of XA mean finding the sum of|w-2|

The first version of this solution was incorrect on its final steps. An edit was made based on user @dxiv's comments below.
From the first relationship, $|w-2|^2=5-2(w+\bar w)$, if w is a root of unity, we have: $$\sum_{i=1}^7(XA_i)^2=\sum_{i=1}^7[5-2(A_i-\bar A_i)]$$ since every $A_i$ is a root of unity.
So $$S=\sum_{i=1}^7[5-2(A_i-\bar A_i)]=35-4i\Im\Big(\sum_{i=1}^7 A_i\Big)$$
since $z-\bar z=2i\Im(z)$.
But as @dxiv observed in the comments, since the LHS is a real number, we must have $$\Im\Big(\sum_{i=1}^7 A_i\Big)=0$$
Thus, $S=35$.