TITLE: Distribution of maximum proportion of heads in an infinite sequence of flips
QUESTION [6 upvotes]: Let $X_1, X_2, X_3, \dots$ be independent variables each of which is $1$ with probability $1/2$ and $0$ otherwise.  Let
$$S_n=\sum_{i=1}^n X_i$$
and define
$$Y = \sup_{n \geq 1} \frac{S_n}{n}$$
With probability $1$, "$\sup$" here can be replaced by $\max$, since $S_n/n$ is approaching $1/2$ by the Law of Large Numbers.  In particular, $Y$ is rational with probability $1$.  I am curious what is known and what has been studied about the distribution of $Y$.  For example, are there closed forms for or bounds on

The expectation and variance of $Y$?
The probability that $Y=q$, for specific rational $q$ between $1/2$ and $1$?  
The probability that $Y \leq \frac{1}{2}+\epsilon$, for small $\epsilon$?

I feel like this is something that has to be well studied, but I'm not sure the specific terms to look under for it.

REPLY [2 votes]: Here is a picture of the distribution of $Y$ on $(\frac 12; 1)$ (I am not showing the top half which is just a vertical segment at $Y=1$)

This plot was made with all the fractions of denominator up to $200$. For $r = p/q$, there are $n=q-p$ roots to find, which you can apparently get with Newton's method starting at the $\exp((-1+2ik \pi)/n)$ for $k=0 \ldots n-1$. That everything lines up properly likes this should be evidence that this heuristic works.
Using the data from all those points gives  $0.77 \le E[Y] \le 0.85$ (the gap corresponds to the missing probability mass, I realize now I could be a lot more precise here).
I think we can prove, looking at $r = 1- \frac 1n$ and the behaviour of the only small root $x_n$ of $1-2x+x^n$, that there is a horizontal tangent at $(1,\frac 12)$ (in fact it should converge exponentially to $\frac 12$). 
To study the behaviour at $Y \approx \frac 12$, one would need to study the roots of $1 - 2x^n + x^{2n+1}$, which seems a bit harder .