Are there identities which show that every odd square is the sum of three squares? I am looking for algebraic identities of the form
$$
  (2n+1)^2 = f(n)^2 + g(n)^2 + h(n)^2,
$$
where the functions are polynomials in $n$.
EDIT: Evidently $(6k)^2 = 36k^2$ is trivially the sum of three squares when $k$ is odd. We also have the identity
$$
  (6k+3)^2 = (2(2k+1))^2 + (2(2k+1))^2 + (2k+1)^2.
$$
Are there similar identities for the other two odd residues modulo $6$, i.e., $6k+1$ and $6k-1$?

That's not really going to work, the highest degree terms do not cancel here, so all you get is $(2n+1)^2 = (2n+1)^2 + 0^2 + 0^2.$
What does work is due to Gordon Pall; every number is the sum of four squares, so write $$ 2n+1 = a^2 + b^2 + c^2 + d^2.$$ Then you get nontrivial expressions
$$ (2n+1)^2 = \left(a^2 + b^2 - c^2 - d^2 \right)^2 + (-2ad+2bc)^2 + (2ac+2bd)^2  $$
and similar things resulting from rearranging the letters $a,b,c,d$ and choosing many $\pm$ signs. 
See Pall_Automorphs_1940.pdf at http://zakuski.math.utsa.edu/~kap/forms.html 
Let's see, if $2n+1$ is already a square, perform the same task for $\sqrt {2n+1},$ so as to be assured of at least two nonzero summands. If $2n+1$ is a fourth power...
Given a specific integral expression such as $9 = 4 + 4 + 1,$ we can produce a rational expression
$$ \left( \frac{4n+2}{3}\right)^2 + \left( \frac{4n+2}{3}\right)^2 + \left( \frac{2n+1}{3}\right)^2 = (2n+1)^2.   $$
While $49 = 36 + 9 + 4$ results in
$$ \left( \frac{12n+6}{7}\right)^2 + \left( \frac{6n+3}{7}\right)^2 + \left( \frac{4n+2}{7}\right)^2 = (2n+1)^2.   $$
These are just three rational multiples of $(2n+1),$ that is the only way it can work. Plus, these only produce integer expressions for certain $n.$
