Any number can be written as a sum of distinct powers of . That is what binary representation means. For example, . If , you jump steps, then , then . Each jump is precomputed.
You combine precomputed results to get the final answer. This decomposition is unique and uses at most powers, giving you the logarithmic query time. Binary representation is what makes it work.