Onset detection asks when events happen; beat detection asks what pulse organizes them. An algorithm collects onsets, hunts for the periodicity that explains them, and locks a predicted grid onto the music, updating as the music argues back.
The failure modes are musical: half-time versus double-time ambiguity, syncopation that outvotes the downbeat, tempo drift in anything played by humans. Robust trackers weight the low end heavily because kick and bass carry the pulse in most produced music.
Prediction is the prize. A system that knows when the next beat should land can anticipate rather than chase, and audiences can feel the difference between visuals that are with the music and visuals a frame behind it.