A sufficient condition for a periodic function to be representable as a Fourier series are the so called Dirichlet conditions:
$f$ must be absolutely integrable over a period.
$f$ must have a finite number of extrema in any given bounded interval, i.e. there must be a finite number of maxima and minima in the interval.
$f$ must have a finite number of discontinuities in any given bounded interval, however the discontinuity cannot be infinite.
But these conditions are known not to be necessary. What is an example function violating these conditions, which still has a Fourier series representation?