Summation of formula

So, I am trying to verify the summation for the following formula, and then to figure out the average value of the formula.

So, if our $N = 3$, then the formula gives:

$\frac13*1+\frac23*(\frac23*2+\frac13*3*(1)) = {17\over 9}$

If $N=4$:

$\frac14*1+\frac34*(\frac24*2+\frac24(\frac34*3+\frac14*4*(1))) = {71\over 32}$

If $N=5$:

$\frac15*1+\frac45*(\frac25*2+\frac35*(\frac35*3+\frac25*(\frac45*4+\frac15*5*(1)))) = \frac{1569}{625}= 2.5104$

Now, the summation as I have figured it out is less a summation, and more of a method to get the total in terms of N. So, the starting portion is

${(n-1)^2\over n^2+1}$ Now, we go from i = 2 to n.

If i < n-1 then we multiply what we have by ${i\over n}$. If i < n-2, we add ${(n-i)^2\over n}$ When i=n, we add ${1\over n}$

This psuedocode above gets the right series of numbers.... but it's not a summation, which I do not need, but it would be nice to know how to do it. What I am really trying to figure out is given n alone, what is the value of the formula, in terms of n of course.

-
This question badly needs formatting – lab bhattacharjee Dec 13 '12 at 16:14
How would you advise that I reformat it then? – dzk87 Dec 13 '12 at 16:19
Like $a/b$ to be replaced by $\frac{a}{b}$ – lab bhattacharjee Dec 13 '12 at 16:34
Reformatting all done, if anybody wants to give this a try.. – dzk87 Dec 13 '12 at 17:01
Here is a GP function to generate this sequence: g(n)=s=(n-1)^2/n+1;for(i=2,n-1,s=s*i/n+(n-i)^2/n);return(s) – Matthew Conroy Dec 13 '12 at 17:35