A classical exercise in a first calculus course is to find a function $f:[0,1]\to \mathbb{R}$ whose discontinuity points are precisely the rational points. An example is the "popcorn function": $$ f(x)=\begin{cases} 1/q \text{ if } x=p/q\in \mathbb{Q} \text{ (in reduced form)} \\ 0 \text{ if } x\notin \mathbb{Q} \end{cases} $$
I was certain that this function is the type designed purely for counter-example purposes, and not the one you would come across "in nature"; up until a year ago when I tried to understand the space of characters of the discrete Heisenberg group. It happens to be a bundle over a circle, where the fiber of a point $x$ is a torus of size $f(x)$:
The meaning of the term character I use here is in the sense of Thoma, as explained in this book. It extends the notion of characters of abelian groups in the Pontryagin sense and of finite groups in the Frobenius sense, and thus provides a way of doing harmonic analysis on arbitrary groups.
In a recent paper, Bader and I study dynamics and random walks on the space above (as well as dual spaces of other nilpotent groups), for the sake of understanding arithmetic groups.

