  In this paper, we investigate the distribution of the maximum of partial sums
of families of $m$-periodic complex valued functions satisfying certain
conditions. We obtain precise uniform estimates for the distribution function
of this maximum in a near optimal range. Our results apply to partial sums of
Kloosterman sums and other families of $\ell$-adic trace functions, and are as
strong as those obtained by Bober, Goldmakher, Granville and Koukoulopoulos for
character sums. In particular, we improve on the recent work of the third
author for Birch sums. However, unlike character sums, we are able to construct
families of $m$-periodic complex valued functions which satisfy our conditions,
but for which the P\'olya-Vinogradov inequality is sharp.
