The CARMENES radial velocity (RV) survey is observing 324 M dwarfs to search for any orbiting planets. In this paper, we present the survey sample by publishing one CARMENES spectrum for each M dwarf. These spectra cover the wavelength range 520--1710nm at a resolution of at least $R > 80,000$, and we measure its RV, H$alpha$ emission, and projected rotation velocity. We present an atlas of high-resolution M-dwarf spectra and compare the spectra to atmospheric models. To quantify the RV precision that can be achieved in low-mass stars over the CARMENES wavelength range, we analyze our empirical information on the RV precision from more than 6500 observations. We compare our high-resolution M-dwarf spectra to atmospheric models where we determine the spectroscopic RV information content, $Q$, and signal-to-noise ratio. We find that for all M-type dwarfs, the highest RV precision can be reached in the wavelength range 700--900nm. Observations at longer wavelengths are equally precise only at the very latest spectral types (M8 and M9). We demonstrate that in this spectroscopic range, the large amount of absorption features compensates for the intrinsic faintness of an M7 star. To reach an RV precision of 1ms$^{-1}$ in very low mass M dwarfs at longer wavelengths likely requires the use of a 10m class telescope. For spectral types M6 and earlier, the combination of a red visual and a near-infrared spectrograph is ideal to search for low-mass planets and to distinguish between planets and stellar variability. At a 4m class telescope, an instrument like CARMENES has the potential to push the RV precision well below the typical jitter level of 3-4ms$^{-1}$.