Without loss of generality, we assume that a1≥a2≥⋯≥an, so also b1≥b2≥⋯≥bn and 0<ai,bi<1. Let S=∑i=1nai2, then bi=ai2/S. Note that S=S⋅∑i=1nai and ∑i=1nbi=1. For 1≤k≤n let
Dk=i=1∑k(bi−ai),
in particular Dn=0, because ∑i=1kai=∑i=1kbi=1. We have for 1≤k<n
S⋅Dk=i=1∑kj=1∑nai2aj−i=1∑kj=1∑naiaj2=1≤i≤kk<j≤n∑aiaj(ai−aj)≥0
because all terms in the sum are non-negative. As S>0, this implies that Dk≥0 for all 1≤k≤n. Note also that one of the terms in the sum, namely a1an(a1−an), is positive unless a1=a2=⋯=an. So we have Dk=0 for 1≤k<n if a1=a2=⋯=an, and Dk>0 for 1≤k<n otherwise. Next observe that, for real numbers a=1 and b=1, we have
1−bb−1−aa=(1−b)(1−a)1⋅(b−a).
Setting ci=1/(1−bi)(1−ai) this implies
D:=i=1∑n1−bibi−i=1∑n1−aiai=i=1∑nci(bi−ai)=i=1∑n−1(ci−ci+1)Di,
where we have used that Dn=0. From ai≥ai+1 and bi≥bi+1 we get ci≥ci+1, hence all terms in this sum are non-negative. This shows that D≥0 which is equivalent to the inequality we want to prove.
As for equality, we have D=0 if and only if every term in the last sum equals 0. If a1=a2=⋯=an, then, as we have seen above, each Di=0 and so the sum is zero. If however not all numbers ai are equal, then we have seen that Di>0 and ci−ci+1≥0 for 1≤i<n. Therefore, all we need to show is that ci>ci+1 for one such i. If not all ai are equal to each other, there exists 1≤i<n such that ai>ai+1 and bi≥bi+1. For this i, the definition of ci indeed implies that ci>ci+1.
Thus the condition for equality is that all the numbers ai are equal to 1/n.