Why n log n Is a Floor
In short: any sort that decides order by comparing two items can be
drawn as a decision tree — one internal node per comparison, branching
yes/no, one leaf per possible final ordering. Sorting n distinct items has
n! possible orderings, so the tree needs at least n! leaves, and a binary
tree with L leaves needs depth at least ⌈log₂ L⌉. That makes
⌈log₂(n!)⌉ comparisons — which works out to Θ(n log n) — the fewest
any comparison sort can need in its worst case. Counting sort isn't a
counterexample: it never compares two items against each other, so the
argument doesn't apply to it at all.

Six lines print, one per leaf of the decision tree in the drawing above — the recursion's call depth is exactly how many choices (comparisons) it takes to pin down one ordering, and the deepest calls go 3 levels in.
Count the orderings of a photo lineup
Quarry's test suite checks a sort against every possible input order for
small n, to catch bugs that only show up on rare arrangements. Before it
can do that, it needs to know how many orderings exist, and the fewest
comparisons any correct sort could need to tell them all apart:
Doubling n from 5 to 10 barely doubles min_comparisons (7 to 22) — the
log in n log n is why sorting scales so much better than the n!
orderings it has to tell apart might suggest.