Random forests are an ensemble learning method used for classification, regression, and other tasks. They operate by constructing a multitude of decision trees during training and outputting the mode of the classes (classification) or mean prediction (regression) of the individual trees. This method is known for its robustness and accuracy.