We connect two a priori unrelated topics, theory of geodesically equivalent
metrics in differential geometry, and theory of compatible infinite dimensional
Poisson brackets of hydrodynamic type in mathematical physics. Namely, we prove
that a pair of geodesically equivalent metrics such that one is flat produces a
pair of such brackets. We construct Casimirs for these brackets and the
corresponding commuting flows. There are two ways to produce a large family of
compatible Poisson structures from a pair of geodesically equivalent metrics
one of which is flat. One of these families is $(n+1)(n+2)/2$ dimensional; we
describe it completely and show that it is maximal. Another has dimension $\le
n+2$ and is, in a certain sense, polynomial. We show that a nontrivial
polynomial family of compatible Poisson structures of dimension $n+2$ is unique
and comes from a pair of geodesically equivalent metrics. In addition, we
generalise a result of Sinjukov (1961) from constant curvature metrics to
arbitrary Einstein metrics.