Toss a coin n times and count the heads k. Under the null hypothesis P(head) = p0, the count has the binomial distribution, so every probability needed for the test is a finite sum. Choose how the rejection region is built, read off the exact p-value, see how the power grows with n, and check that a p-value from a discrete statistic is super-uniform: P(p ≤ α) ≤ α, usually with strict inequality.
The two-sided p-value is the one of R's binom.test: the total null probability of all outcomes that are not more probable than the observed one. For p0 = 0.5 it equals 2 P(K ≥ max(k, n − k)).
code/ch06_testing.R (functions greedy_region, pbinom_region, Figures 6.5 to 6.7). This page reproduces the reference values (p-value 0.088626 for 59 heads in 100 tosses, region sizes 0.046044 and 0.035200, power 0.462093).