Contact Lie systems: theory and applications