This is discussed, inter alia, in Evan Chen's "Introduction to functional equations". Briefly:
$\begin{align*}
\frac{f(x) + f(y)}{2}
&= f\left(\frac{x + y}{2}\right)
\end{align*}$
Clearly, $f(x) = k x + c$ works. So it makes sense to try $g(x) = f(x) - f(0)$:
$\begin{align*}
\frac{g(x) + g(y) + 2 f(0)}{2}
&= f\left(\frac{x + y}{2}\right) \\
\frac{g(x) + g(y)}{2}
&= f\left(\frac{x + y}{2}\right) - f\left(\frac{0 + 0}{2}\right) \\
\frac{g(x) + g(y)}{2}
&= g\left(\frac{x + y}{2}\right)
\end{align*}$
Same equation, but we know $g(0) = 0$. Now we have both:
$\begin{align*}
g(x) + g(0)
&= 2 g\left(\frac{x}{2}\right) \\
g(x)
&= 2 g\left(\frac{x}{2}\right) \\
g(x) + g(y)
&= 2 g\left(\frac{x + y}{2}\right) \\
&= g(x + y)
\end{align*}$
This is Cauchy's functional equation.
First off, $2 g(0) = g(0)$, so $g(0) = 0$; $g(x) + g(-x) = g(0) = 0$, so $g(-x) = - g(x)$.
If $n$ is a positive integer, by repeating the equation $n$ times we get:
$\begin{align*}
g(n)
&= n g(1)
\end{align*}$
Take a rational $p / q$ ($p, q$ integers). Repeating the function $q$ times we get:
$\begin{align*}
q \cdot g\left(\frac{p}{q}\right)
&= g\left(q \cdot \frac{p}{q}\right) \\
g\left(\frac{p}{q}\right)
&= \frac{g(p)}{q} \\
&= \frac{p}{q} \cdot g(1)
\end{align*}$
But this does not define the values of $g$ at irrational $x$, we can take e.g. $g(\sqrt{2})$ to be anything, and the equation allows us to extend this to, for rational $r$:
$\begin{align*}
g(r \sqrt{2})
&= r g(\sqrt{2})
\end{align*}$
But, again by the equation, for rational $r_1$ and $r_2$, we can write:
$\begin{align*}
g(r_1 + r_2 \sqrt{2})
&= g(r_1) + g(r_2 \sqrt{2}) \\
&= r_1 g(1) + r_2 g(\sqrt{2})
\end{align*}$
Same for any other irrational that is linearly independent over $\mathbb{Q}$... this gives a whole truckload of different solutions, all endearingly discontinuous.
And it looks so innocent...