Since n is odd, n4≡1(mod8). Since xi is odd, xi2≡1(mod8) for 1≤i≤n. Hence n=x12+x22+⋯+xn2≡n4≡1(mod8).
On the other hand, if n≡1(mod8), then odd numbers x1,x2,…,xn satisfying the required equality can be found. If n=1, then x1=1 will do: n4=1=x12. If n=8k+1 where k is a positive integer, then
n4=(8k+1)4=(8k−1)4+(8k+1)4−(8k−1)4=(8k−1)4+((8k+1)2−(8k−1)2)((8k+1)2+(8k−1)2)=(8k−1)4+32k(128k2+2)=(8k−1)4+4k(32k−1)2+(16k−1)2+(92k−1)=(8k−1)4+4k(32k−1)2+(16k−1)2+92(k−1)+91=((8k−1)2)2+4k(32k−1)2+(16k−1)2+(k−1)(92+32+12+12)+(92+32+12)
gives n4 as a sum of 1+4k+1+4(k−1)+3=8k+1=n odd perfect squares.