Soft and slick tires will have the best grip until a water layer of a wet surface gets thick enough and manages to separate the tire from the ground... at that stage you start aquaplaning

and you are gone!
To solve this issue, manufacturers introduce some threading in the tire so that they would guide and evacuate the water from underneath it, avoiding the aquaplaning effect. The bigger the quantity of water that you need to evacuate and the bigger and deeper the threads. Think of them as pathways for the water to exit (sideways)
This apply to any substance in fact that is getting in the way between your tire and the ground, whether it is water, snow, mud, dirt and so on...
Thus, the difference in design between tires intended for road, wet, snow, mud, gravel and so on.
Manufacturers have R&D units that do these extensive engineering tests and trials to find a balance between grip, rolling resistance, life cycle, weight, price, and so on... And they come up with their own shape of threads, material, construction, etc.
Mother nature and physics makes it impossible to optimize all these factors at the same time; they act against each other most of time
Tire science is of course much more detailed than this; you have also temperature playing a big role, weight and so on... But a casual biker in my opinion would just try the model recommended by his friend or over a forum and see if that works for him or not. I would do the same too
I just wanted to give some insight on the subject for the interested
In the end, and as a very rough guideline, you have to favor slick or very shallow threaded tires if the majority of your pathway is "clean" and dry; increasing the amount and depth of threads according to your level of "pollution" on these pathways.
Cheers
Fadi
PS: Those living in cold regions, can quickly compare the amount and depth of threads on their car'swinter tires compared to the summer ones