Precision (of the things you flagged, how many were real) and recall (of the real things, how many you flagged) can each be gamed by sacrificing the other, so the F1 score fuses them with a harmonic mean, which drags the combined score toward whichever of the two is worse. The generalisation, the F-beta score, weights recall beta times as heavily as precision when the two error types genuinely cost different amounts.
Two practical notes. F1 depends on the classification threshold, and on imbalanced problems the F1-optimal threshold is usually far from the default 0.5, so it should be chosen on validation data rather than inherited. And in multi-class settings the averaging scheme (macro, micro, or weighted) changes what the number means: macro treats every class equally, micro lets frequent classes dominate.
