Reducing acquisition time is a crucial challenge for many imaging techniques. Compressed sensing (CS) theory offers an appealing framework to address this issue since it provides theoretical guarantees on the reconstruction of sparse signals by projection on a low-dimensional linear subspace. In this paper, we focus on a setting where the imaging device allows us to sense a fixed set of measurements. We first discuss the choice of an optimal sampling subspace allowing perfect reconstruction of sparse signals. Its design relies on the random drawing of independent measurements. We discuss how to select the drawing distribution and show that a mixed strategy involving partial deterministic sampling and independent drawings can help in breaking the so-called coherence barrier. Unfortunately, independent random sampling is irrelevant for many acquisition devices owing to acquisition constraints. To overcome this limitation, the notion of a variable density sampler (VDS) is introduced and defined as a stochastic process with a prescribed limit empirical measure. It encompasses samplers based on independent measurements or continuous curves. The latter are crucial to extend CS results to actual applications. We propose two original approaches to designing a continuous VDS, one based on random walks over the acquisition space and one based on the travelling salesman problem. Following theoretical considerations and retrospective CS simulations in magnetic resonance imaging, we intend to highlight the key properties of a VDS to ensure accurate sparse reconstructions, namely its limit empirical measure and its mixing time.