Matter and radiation are gravitationally attractive, so
in a maximally symmetric spacetime filled with matter, the gravitational
force will inevitably cause any lumpiness in the matter to grow and
condense. That's how hydrogen gas turned into galaxies and stars. But
vacuum energy comes with a high vacuum pressure, and that high vacuum
pressure resists gravitational collapse as a kind of repulsive gravitational
force. The pressure of the vacuum energy flattens out the lumpiness,
and makes space get flatter, not lumpier, as it expands.
So one possible solution to the flatness problem would
be if our Universe went through a phase where the only energy density
present was a uniform vacuum energy. The maximally symmetric solution
to the Einstein equation under those conditions is called de Sitter
space and the metric can be written

In de Sitter cosmology, the Hubble parameter H is constant and related
to the cosmological constant as shown.
The vacuum energy density is uniform in space and time,
so the ratio of the curvature of space to the energy density will decrease
exponentially as space expands in time:

Any deviations from flatness will be exponentially suppressed by the
exponential expansion of the scale factor, and the flatness problem
is solved.
Both the de Sitter spacetime and the Robertson-Walker spacetime
start expanding from a(t) close to zero. But for a spacetime with matter
or radiation, a(t) goes to zero when the time t goes to zero, because
a(t) goes like a power of t. When the scale factor depends exponentially
on time, the scale factor goes to zero when time t goes to minus infinity.
Therefore the horizon distance integral can blow up instead of neatly
converge

and solve the horizon problem.

But how does Inflation work?

The vacuum energy that drives the rapid expansion in an
inflationary cosmology comes from a scalar field that is part of the
spontaneous symmetry breaking dynamics of some unified theory particle
theory, say, a Grand Unified Theory or string theory.
This scalar field is sometimes called the inflaton.
The equation of motion for this field in the de Sitter metric above
is

and the Einstein equation with a scalar field density becomes

The conditions for inflationary behavior require that the scalar field
time derivatives are small compared to the potential, so that most of
the energy of the scalar field is in potential energy and not kinetic
energy

These are called the slow roll conditions because the scalar field
evolves slowly when these conditions are satisfied.
Another crucial element in an inflationary model
is the thermal behavior of the scalar field effective potential V_{eff}(f).
The effective potential includes quantum corrections from particle scattering.
The shape of the potential can change with temperature, allowing for
phase transitions. At very high temperatures, higher than some critical
temperature T_{crit}, the minimum of the effective potential
is at zero, in the symmetric phase of the theory. As the temperature
drops to T=T_{crit}, a second minimum forms in the potential
at some value f_{0} and
the vacuum with f=0 becomes metastable.
At temperature T<T_{crit}, the new minimum f=f_{0}
becomes the energetically favorable vacuum configuration. (The scale
usually assumed for T_{crit} is the GUT scale of about 10^{14}
GeV.)
In an inflation model, rather than making uniform
transition to the new vacuum, the field stays in the old vacuum, now
called the false vacuum. (When steam does this in the gas-to-liquid
phase transition of water at T_{crit}=373°K, it is called
supercooling.) The vacuum energy of the supercooled false vacuum drives
a de Sitter expansion of the Universe (or the part of it that becomes
our Universe) which is called the period of inflation, with cosmological
constant L given by

where V(0) is the value of the scalar potential in the false vacuum.
Eventually bubbles form of the true vacuum in the broken
symmetric phase with f=f_{0}.
The slow roll parameters grow large and the inflationary phase comes
to an end. If the the false vacuum bubble has expanded by at least 60
e-folds, the horizon and flatness problems are no more, because the
radiation-dominated expansion that follows comes out of one extraordinarily
flat causally connected domain.

A testable prediction?

It's always good to have testable predictions from a theory
of physics, and the inflation theory has a distinct prediction about
the density variations in the cosmic microwave background. A bubble
of inflation consists of accelerating vacuum. In this accelerating vacuum,
a scalar field will have very small thermal fluctuations that are nearly
the same at every scale, and the fluctuations will be have a Gaussian
distribution. This prediction fits current observations and will be
tested with greater precision by future measurements of the cosmic microwave
background.

So are all the problems solved?

Despite the prediction above, inflation as described above
is far from an ideal theory. It's too hard to stop the inflationary
phase, and the monopole problem has other ways of resurfacing in the
physics. Many of the assumptions that go into the model, such as an
initial high temperature phase and a single inflating bubble have been
questioned and alternative models have been developed.
Today's inflation models have evolved beyond the original
assumption of a single inflation event giving birth to a single Universe,
and feature scenarios where universes nucleate and inflate out of other
universes in the process called eternal inflation.
There is also another attempt to solve the problems of
Big Bang cosmology using a scalar field that never goes through an inflationary
period at all, but evolves very slowly so that we observe it as being
constant during our own era. This model is called quintessence,
after the ancient spiritual belief in the Quinta Essentia, the spiritual
matter from which the four forms of physical matter are made.
Another currently unsolved problem is the how to accommodate
for Inflation in string cosmology and M-theory cosmology. There are
dimensions to compactify, branes to wrap, hierarchies to set, geometry
to resolve, supersymmetry to break -- a laundry list of processes and
transitions that have to be described within in a string theory cosmology.