This problem can be formulated with the aid of lagrange multipliers.
#L(theta,lambda)=sum_(i=1)^nsin^2theta_i-lambda (sum_(i=1)^n theta_i + pi)#
The stationary points are given by
#2cos theta_i sin theta_i-lambda=0# for #i=1,2,cdots,n# or
#sin(2theta_i)=lambda# or
#theta_i = 1/2arcsin(lambda)# or
#sum_(i=1)^n 1/2arcsin(lambda)=n/2arcsin(lambda) = pi# then
#lambda = sin((2pi)/n)=sin(2theta_i)# and
#theta_i = pi/n# for #i=1,2,cdots,n#
Now checking we have
#{(n=1->sin^2(pi)=0),(n=2->2sin^2(pi/2)=2),(n=3->3sin^2(pi/3)=9/4),(n=4->4sin^2(pi/4)=2),(n=5->5sin^2(pi/5)=5/8(5-sqrt(5))),(cdots):}#
So the maximum is #9/4# and for #n > 3# the maximum is preserved making #theta_1=theta_2=theta_3 = pi/3# and #theta_i = 0# for #i = 4,5,cdots,n#