All suffixes are sorted once; the rows that start with the pattern are then one contiguous block. Two binary searches find its two ends - lower bound, then upper bound - so a query costs O(m log n) instead of scanning the text. The bar next to each row is its LCP with the row above.
The science
The suffix array SA[i] lists the start positions of the suffixes in lexicographic order. It is built here by prefix doubling: sort by the first k characters using the pair (rank[i], rank[i+k]), then double k; after ⌈log2 n⌉ rounds the ranks are unique, giving O(n log² n) with comparison sorting (O(n log n) with radix sort; SA-IS reaches O(n)).
The LCP array (Kasai) stores the longest common prefix of neighbouring suffixes in O(n): if suffix i shares h characters with its predecessor, suffix i+1 shares at least h−1 with its own predecessor, so h never needs to restart. It yields the number of distinct substrings n(n+1)/2 − Σ LCP and the longest repeated substring (max LCP).
Search: every suffix that starts with P sits in one contiguous block of SA. Binary search for the first suffix ≥ P and the first suffix whose m-prefix is > P; each probe compares up to m characters, so the cost is O(m log n) - at most ⌈log2(n+1)⌉ probes per bound, which is why genome-scale tools index texts this way.
Simplifications: no end-of-text sentinel (shorter suffix sorts first), case-sensitive ASCII order, texts up to 40 characters so every row is visible; production indexes (FM-index, SA-IS) use compressed and linear-time variants.
Independent checks: prefix doubling against sorting every suffix, Kasai against row-by-row comparison, the distinct-substring formula against a set, binary search against a brute-force scan for every short substring, and the probe budget.