Some additions to the answer of MBR:
In fact, we do not know that dark matter and dark energy do exist, but we have indirect clues. You will often see claims that dark matter and dark energy are two of the major problems of cosmology today, including by professionnalprofessional astronomers, but this is an epistemological misconception: you cannot name an hypothesiscall a problemhypothesis a problem.
Currently we have several observational anomalies (as defined per T. Kuhn): namely the rotation curve of galaxies, the luminosity of supernovae, the power spectrum of the CMB... (and some additional things like the difficulty to measure G or to detect directly gravitationnalgravitational waves).
According to the history of science, we have 3 ways to solve these anomalies:
- ontological approaches (dark matter and dark energy)
- legislatives approaches (extensions of General Relativity)
- paradigmicparadigmatic approaches (inhomogenousinhomogeneous Universes)
Dark matter and dark energy are two ontological approaches that seems to work pretty well: by adding two simple components we can fit a wide range of observations. This is why astronomers like them: their modelization are relatively easy and allow to fit everything well. But for the moment we do not know their nature.
Some say that with WMAPWMAP (Wilkinson Microwave Anisotropy Probe) and PlanckPlanck space observatory we have entered in the era of precision cosmology: but this is only true if our paradigm of dark matter/dark energy approaches is correct. If this is not the case, we currently do not interpret correctly what we measure, but ultimately more accurate measures can lead to a better view of current cosmological anomalies.
So dark matter and dark energy are two elegant and minimalist approaches to several fundamental problems. This is a very hot topic in cosmology, but we may realize, one day, that we only had problems because our current paradigm was erroneous.