Random intercepts are used in mixed-effects models to account for variability across groups or subjects by allowing each group to have its own baseline level. This approach helps to capture unobserved heterogeneity and improve model accuracy by acknowledging that not all groups start from the same point.