Why do racing drivers often use smooth tyres in the dry weather and stop to fit tyres with thread if it is wet?

For maximum traction.