This is an elusive but important issue. Fit can indeed mean that a particular person just sparkled in an interview. The AHA perspectives is often unhelpful in these regards. Fir can work in other ways. Suppose a medium sized dept whose early modernist does Tudor England and one of whose modernists does Britisn Empire.
Chronology is an issue sometimes.
I prepare students in ealry medieval history. My students have sometimes fallen out of competition because, in small to medium departments, the ancient historian does Roman Empire. That place will want a high or late medievalist. Often, indeed, it is a vey importatn pasrt of what happens as a department works through a set of applications. But to echo cathy Mooney, it is not true that inferior candidates are getting jobs on any kind of a regular basis.