The "Nested square roots of 2" section of the Wikipedia entry "Nested radical" (https://en.m.wikipedia.org/wiki/Nested_radical) describes some properties of finite nested square roots of 2 which have the following general form
$\sqrt{2\pm\sqrt{2\pm\sqrt{2\pm\ldots\pm\sqrt{2}}}}$
While it is stated that this expression is related to sine and cosine, it is not clear to me from the information given there or from other related articles on the Internet what the parametric form of the trigonometric expression is that is equal to the radical expression above, nor how to which we can determine the unknown signs when the trigonometric expression is given. However, I had worked on this problem many years ago and I believe that my solution, which I present here, is correct. What I didn't know was that my method was related to the Gray code (https://en.m.wikipedia.org/wiki/Gray_code). I found this out when I searched the OEIS for the relevant sequences resulting from my method (even my method of converting an integer to Gray code, which I am listing at the end of this post, is different from the established method as I was unaware of the existence of this code in those days, however it can easily be proved that the new method is just as correct).
I present my method briefly, in the form of a mathematical textbook. A proof of these results would be desirable.
It is about these two relationships:
$2\sin\left(\frac{90^\circ(2m+1)}{2^n}\right)=\sqrt{2_1-\sqrt{2_2\pm\sqrt{2_3\pm \ldots\pm\sqrt{2_n}}}}$
$2\cos\left(\frac{90^\circ(2m+1)}{2^n}\right)=\sqrt{2_1+\sqrt{2_2\pm\sqrt{2_3\pm \ldots\pm\sqrt{2_n}}}}$
where the following restrictions apply:
$n=1,2\Rightarrow m=0$
$n\ge2\Rightarrow 0\le m\le 2^{n-2}-1$
If the values of $n, m$ are given, we can determine the values of the string of signs $\pm$ in the nested radicals. That is, we have an signs equation, which we solve as follows:
We convert the number m to its Gray code (binary) and then map the digits to the signs $1=-$ and $0=+$. The resulting string is the requested solution of the signs equation.
example with $n=8, m=57$:
$2\sin\left(\frac{90^\circ(2\cdot57+1)}{2^8}\right)=\sqrt{2-\sqrt{2\pm\sqrt{2\pm\sqrt{2\pm\sqrt{2\pm\sqrt{2\pm\sqrt{2\pm\sqrt{2}}}}}}}}$
The Gray code of $57$ is $100101$, which corresponds to the string $-++-+-$, so the solution is:
$2\sin\left(\frac{90^\circ(2\cdot57+1)}{2^8}\right)=\sqrt{2-\sqrt{2-\sqrt{2+\sqrt{2+\sqrt{2-\sqrt{2+\sqrt{2-\sqrt{2}}}}}}}}$
Determining the values of the parameters $n$ and $m$ of the trigonometric expression when the radical expression is known it is too simple a process to need a separate description here.
My method for converting an integer to Gray code (binary) uses successive divisions by powers of $2$ and looks at the parity of the rounded quotient. eg:
$29/2=14.5\thicksim15\rightarrow1$
$29/4=7.3\thicksim7\rightarrow1$
$29/8=3.6\thicksim4\rightarrow0$
$29/16=1.8\thicksim2\rightarrow0$
$29/32=0.9\thicksim1\rightarrow1$
The decimal value $29$ has the binary value $10011$ in Gray code.