We discuss Hilbert–Kunz function from when it was originally defined to its recent developments. A brief history of Hilbert–Kunz theory is first recounted. Then we review several techniques involved in the study of Hilbert–Kunz functions by presenting some illustrative proofs without going into details of the technicalities. The second part of this article focuses on the Hilbert–Kunz function of an affine normal semigroup ring and relates it to Ehrhart quasipolynomials. We pay extra attention to its periodic behavior and discuss how the cellular decomposition constructed by Bruns and Gubeladze fits into the computation of the functions. The closed forms of the Hilbert–Kunz function of some examples are presented. The discussion in this part highlights the close relationship between Hilbert–Kunz function and Ehrhart theory.