Guess the number
A number between 1 and 100 can always be found in 7 guesses. Between 1 and 1000, in 10. Not usually: always. Play both ways and watch the bar of possibilities shrink.
What's going on
Each answer of "higher" or "lower" throws away part of the range. If you guess in the middle, you throw away half, whatever the answer is. Halving 1000 gives 500, then 250, 125, 63, 32, 16, 8, 4, 2, 1. That is ten halvings, so ten guesses always suffice. For 100 it is seven.
The number of halvings needed is the number of binary digits in the range, which is why the bound is written log₂. Doubling the range costs just one more guess: a million numbers need only 20. The same idea is how a dictionary is searched, how a computer looks something up in a sorted list, and why twenty yes-or-no questions can pick out one of a million things.
Guessing in the middle is the best possible strategy. Guessing anywhere else risks keeping the bigger half, and an unlucky run of those costs you extra guesses.