Evaluate $\lim\limits_{n\to\infty}\big(\frac{n}{2}+\min\limits_{x\in\mathbb{R}}\sum_{k=0}^n{\cos(2^k x)}\big)$ What is the exact value of the following limit?
$$L=\lim_{n\to\infty}\left(\frac{n}{2}+\min_{x\in\mathbb{R}}\sum_{k=0}^n{\cos(2^k x)}\right)$$
Experimenting on desmos suggests the following claims:

$\sum_{k=0}^n{\cos{(2^k x)}}$ is minimized when $x\approx \left(2m\pm\dfrac{2}{3}\right)\pi,m\in\mathbb{Z}$, with the approximation approaching equality as $n\to\infty$


$L\approx -0.704$

I do not know how to prove these claims.
(This question was inspired by another question.)
 A: Long comment. I believe this type of question is extremely hard, if not impossible by the current technology, to answer. However, let me share some observation.
Define $\varphi_n$ by the $n$th sum:
$$ \varphi_n(x) = \frac{n}{2} + \sum_{k=0}^{n} \cos(2^k x) $$
We will consider the behavior of $\varphi_n (x)$ near $x = \frac{2\pi}{3}$.
\begin{align*}
\varphi_n\left(\frac{2\pi}{3} + (-1)^n \frac{x}{2^n} \right)
&= \frac{n}{2} + \sum_{k=0}^{n} \cos\left(\frac{2^{k+1}\pi}{3} + (-1)^n \frac{x}{2^{n-k}}\right) \\
&= \frac{n}{2} + \sum_{k=0}^{n} \left[ -\frac{1}{2}\cos\left(\frac{x}{2^{n-k}}\right) + (-1)^{n-k+1}\frac{\sqrt{3}}{2}\sin\left(\frac{x}{2^{n-k}}\right) \right] \\
&= -\frac{1}{2} + \sum_{k=0}^{n} \left[ \sin^2\left(\frac{x}{2^{n-k+1}}\right) + (-1)^{n-k+1}\frac{\sqrt{3}}{2}\sin\left(\frac{x}{2^{n-k}}\right) \right] \\
&= -\frac{1}{2} + \sum_{j=0}^{n} \left[ \sin^2\left(\frac{x}{2^{j+1}}\right) + (-1)^{j+1}\frac{\sqrt{3}}{2}\sin\left(\frac{x}{2^{j}}\right) \right] \\
&= -\frac{1}{2} + 2 \sum_{j=0}^{n} \sin\left(\frac{x}{2^{j+1}}\right)\sin\left(\frac{x}{2^{j+1}}+(-1)^{j+1}\frac{\pi}{3}\right).
\end{align*}
Using this, define $\psi(x)$ by
$$ \psi(x) = -\frac{1}{2} + 2 \sum_{j=0}^{\infty} \sin\left(\frac{x}{2^{j+1}}\right)\sin\left(\frac{x}{2^{j+1}}+(-1)^{j+1}\frac{\pi}{3}\right). $$
Since $\varphi_n \bigl( \frac{2\pi}{3} + (-1)^n \frac{x}{2^n} \bigr)$ converges locally uniformly to $\psi(x)$ on $\mathbb{R}$, it follows that
$$\inf_{x\in\mathbb{R}} \psi(x) \geq \limsup_{n\to\infty} \left( \min_{x\in\mathbb{R}} \varphi_n(x) \right). $$
A numerical calculation suggests that $L = \inf \psi$ with an approximate value
$$\inf \psi \approx -0.70399210451640656752$$
at $x \approx 0.66123108104874561312$. Unfortunately, all the inverse symbolic calculators I tried could not identify this value. My gut is also telling that $L$ has no elementary closed-form, but again, this is rather a bold claim.
For fun, I included the graph of $\psi$:

A: This is far from an answer. The goal is to simplify the expression and to connect this problem with ergodic theory. We first note that w.l.o.g, we can assume $x\in[0,\pi]$. Denote $y=x/\pi$. Let the binary expansion of $y$ be $0.y_{1}y_{2}…y_{k}…$ (we exclude the expansion ending with all $0$ to make it unique). Then some algebra will show for $k\geq 1$ $cos(2^ky\pi)=cos(2*(0.y_{k}y_{k+1}…)*\pi)$.
Now let us define a few maps. Let $G$ maps $y\in[0,1]$ to the spaces of sequences (with each entry being either 0 or 1) $(y_{1},y_{2},……)$ using the binary expansion and let $G^{-1}$ be the inverse. Then define the Bernoulli shift $T$ on $(y_{1},y_{2},……)$ by $T(y_{1},y_{2},……)= (y_{2},y_{3},……)$
Finally, $\frac{1}{n}\sum_{k=1}^{k=n}cos(2^kx)=\frac{1}{n}\sum_{k=1}^{k=n}cos(2\pi G^{-1}T^{k-1}Gy)$. Then by using the Birkhoff ergodic theorem, for almost all $y$, the above converges to $\int_{0}^{1}cos(2\pi t)dt = 0$. But for $ y=\frac{2}{3}=0.101010…$,  an explicit calculation shows that in this special case, the limit is $-\frac{1}{2}$
