what is this sum of squares of algebraic functions? This question is inspired by the MO query here, although it has no direct implications.
Define the family of polynomial functions
$$f_n(x)=n^2x^{n-1}-\frac{d}{dx}\left(\frac{x^n-1}{x-1}\right),$$
and the associated family of algebraic functions
$$g_n(x)=\frac{\sqrt{f_n(x)}}n+\sum_{j=1}^{n-1}\frac{\sqrt{f_j(x)}}{j(j+1)}.$$

Question. Despite the complicated expressions for $f_n$ and $g_n$, does 
  $$h_n(x)=\sum_{k=0}^n\left(g_n(x)-g_k(x)\right)^2$$
  have a neat (closed) formula? 
UPDATE. user64494 (see below) has found $h_n(x)=nx^{n-1}$. Any proof?

Convention: $g_0:=0$ and empty sums are zero.
For example, $h_2(x)=g_2(x)^2+(g_2(x)-g_1(x))^2+(g_2(x)-g_2(x))^2=2x$.
 A: The results of the Mathematica's code 
f := Function[{n, x}, n^2*x^(n - 1) - D[(x^n - 1)/(x - 1), x]]
g := Function[{n, x},Sqrt[f[n, x]]/n + Sum[Sqrt[f[j, x]]/(j*(j + 1)), {j, 1, n - 1}]]
n = 60; FullSimplify[ g[n, x]^2 + Sum[(g[n, x] - g[k, x])^2, {k, 1, n}]]


60 x^59 

n = 34; FullSimplify[g[n, x]^2 + Sum[(g[n, x] - g[k, x])^2, {k, 1, n}]]


34 x^33

suggest the answer $nx^{n-1}$. The same result is obtained with Maple 2016 through
restart; f := (n, x)-> n^2*x^(n-1)-(diff((x^n-1)/(x-1), x)):
g := (n, x) -> sqrt(f(n, x))/n+sum(sqrt(f(j, x))/(j*(j+1)), j = 1 .. n-1) :
simplify(expand([seq(sum((g(N, x)-g(k, x))^2, k = 1 .. N)+g(N, x)^2, N = 1 .. 5)]));


[1, 2*x, 3*x^2, 4*x^3, 5*x^4] 

A: A large part of the result doesn't really depend on $f_n$. For an arbitrary sequence $(a_n)$, define two sequences by $G_0=0$, $H_0=0$, and for $n\ge1$,
$$G_n=\frac{a_n}{n}+\sum_{j=1}^n{\frac{a_j}{j(j+1)}}\quad\text{and}\quad H_n=\sum_{k=0}^n{(G_n-G_k)^2}.$$
Then 
$$H_{n+1}-H_n=G_{n+1}^2-G_n^2+\sum_{k=1}^n{(G_{n+1}-G_n)(G_{n+1}+G_n-2G_k)}.$$
The right-hand side simplifies to
$$(G_{n+1}-G_n)\big((n+1)(G_{n+1}+G_n)-2\sum_{k=1}^n{G_k}\big),$$
where the last sum simplifies a lot:
$$\sum_{k=1}^n{G_k}=(n+1)\sum_{j=1}^n{\frac{a_j}{j(j+1)}}$$
so that in the end everything telescopes and
$$H_{n+1}-H_n=\frac{1}{n+1}(a_{n+1}^2-a_n^2).$$
Applying this with $a_n=\sqrt{f_n(x)}$ gives 
$$h_{n+1}(x)-h_n(x)=\frac{1}{n+1}(f_{n+1}(x)-f_n(x))=\frac{1}{n+1}\left((n+1)^2x^n-n^2x^{n-1}-\frac{d}{dx}\left(\frac{x^{n+1}-x^n}{x-1}\right)\right)=
\frac{1}{n+1}\left((n+1)^2x^n-n(n+1)x^{n-1}\right)=(n+1)x^n-nx^{n-1},$$
whence the proof by induction.
