Analytical and numerical modelling of coronal mass ejections to understand their space weather impact