Reading Seva's answer to this question, I got lost at the line relating $\sum_{a\in A} r(a)$ to $|A\cap 2A|$. More precisely, restating the problem:
Let $A\subseteq\mathbb{Z}_n$ be an set of consecutive elements of size $|A|=\delta n$, for some $\delta > \frac{1}{3}$. Defining $r(x)$ to be the number of representations of $x\in\subseteq\mathbb{Z}_n$ as the sum of two elements of $A$, that is $$ r(x)\stackrel{\rm{}def}{=}\left|\{(a_1,a_2)\in A^2 : a_1+a_2 = x\}\right| $$ What is the best expression/approximation one can get for $\sum_{a\in A} r(a)$? And in particular, assuming one gets an expression for $|A\cap 2A|$, how is it related to the former quantity?
Through a rather ad hoc argument involving a distinction of cases, I (thanks to a friend of mine) convinced myself that $$|A\cap 2A| = \begin{cases} (3\delta-1)n + O(1) & \delta\in\left(\frac{1}{3},\frac{1}{2}\right] \\ |A|=\delta n & \delta>\frac{1}{2} \\ \end{cases} $$ but do not know how to get to $\sum_{a\in A} r(a)$ from there.
(Rk: for the application I'm thinking of, $\delta=1-\epsilon$ for small constant $\epsilon$ (still $\gg\frac{1}{n}$)).
Thanks,
Clément