Why would you expand a square wave in a Fourier series? The periodic square wave
$$ f(x) = \cases{ 1 \text{ if } 0 \le x \le \pi \\ 0 \text { if } -\pi \le x < 0} $$
seems easy enough to work with. Why transform it into a series of sines and cosines?
I'm writing up take-home bonus problems for my Calculus II class. I know one of my students is interested in Fourier series and it's relevant to many others, I'm sure, so one of the problems is a easy Fourier expansion of the square wave. I'd like to include in the introduction why someone might turn a seemingly-simple function like this into an infinite sum of trig functions.
 A: There are certainly many places within mathematics where the Fourier series / transform would be useful. I'd also like to mention that it's a huge component of many practical areas; one in particular is digital signal processing. The square wave you mentioned can literally be heard as a sound played out over time (i.e. signal represented in the time domain). What if you want to store that sound on a computer? And can you do it without using too much space? Computing the Fourier series / transform for the square wave lets you break it down into a set of frequencies (i.e. signal represented in the frequency domain). This leads to interesting ways to store and compress audio information. (A very simple example: viewing a signal in the frequency domain makes it easy to chop off frequencies inaudible to the human ear, reducing file size possibly at the cost of quality.)
You might be interested in:
Shannon-Nyquist Sampling Theorem
MP3 Encoding
A: From the applied side, one could say that the motivation lies in trying to solve some partial differential equations like diffusion equations or wave equations.
For example, the diffusion of heat along a rod can be modeled as
$$u_t = c^2u_{xx} \quad (*)$$
where $u(x,t)$ is the temperature at position $x$ of the rod at time $t$.  We are given the initial distribution of heat: that is, at $t=0$, $u(x,0) = f(x)$.  We wish to find a solution to $(*)$.
A common way to solve this involves writing $u$ as a (Fourier) series.  In particular, if $f(x)$ can be written as $\sum_{k=1}^\infty a_k \sin(kx)$, then one has that $$u(x,t) = \sum_{k=1}^\infty a_k\sin(kx)e^{-k^2t}$$ is indeed the solution to $(*)$.  Notice that even when $f(x)$ is as simple as the one you've given, $(*)$ is still hard to solve without use to Fourier series.
(Disclaimer: of course, technically I should be careful about boundary conditions of the differential equations and about the convergence of the sequence.  I vastly simplified stuff since we are only trying to have a motivation.)
A: A $caveat$: the given function is not periodic, so no Fourier series can be directly computed. One introduces a periodic extension, let us say $\hat{f}$, of $f$ and to applies the Fourier series theory to it, instead. If we consider the function (or "signal")
$$f(x)=1,~~x\in[0,\pi]$$
then  even / odd $2\pi$-periodic square wave extensions are available. 
Now, given the chosen periodic extension $\hat{f}$ of $f$ one considers its Fourier series because the series itself is just a linear combination of very simple periodic functions, and the function $\hat{f}$ is fully characterized by the set of "numbers" called Fourier coefficients, and its period. 
This remarkable property becomes even more important when dealing with (arbitrarily) complex periodic functions.
Considering that square waves are very common in engineering, the above simplification becomes relevant. As in most applications one can  consider $de facto$ a finite subset of all Fourier coefficients of a given function, the gain in manipulating Fourier series becomes even more evident.
A: Here are two applications of such a development. In order to simplify matters I consider the following odd periodic function:
$$f(x):=\cases{-1\quad&$(-\pi<x<0)$\cr 
1\quad&$(0<x<\pi)$\cr 
f(x+2\pi)\quad&(all $x$) .\cr}$$
This $f$ can be developed into a sine series of the form
$\sum_{k=1}^\infty b_k\>\sin(k t)$ with
$$b_k={2\over\pi}\int_0^\pi f(t)\>\sin(kt)\  dt=\cases{{4\over\mathstrut \pi k}\quad&($k$ odd)\cr 0&($k$ even) ,\cr}$$
and is represented by this series at all points of continuity. In particular one has
$$1=f\left({\pi\over2}\right)={4\over\pi}\sum_{k\geq 1\ {\rm odd}}^\infty{\sin(k\pi/2 )\over k}={4\over\pi}\left(1-{1\over3}+{1\over 5}-{1\over7}+\ldots\right)\ ,$$
from which we immediately get the famous
$$1-{1\over3}+{1\over 5}-{1\over7}+\ldots={\pi\over 4}\ .$$
When Parseval's formula 
$${1\over4}|a_0|^2+{1\over2}\sum_{k=1}^\infty\bigl(|a_k|^2+|b_k|^2\bigr)={1\over 2\pi}\int_{-\pi}^\pi |f(t)|^2\ dt\tag{1}$$
 is available we can obtain a more spectacular result. In our case the formula $(1)$ gives
$${1\over2}\sum_{k\geq 1\ {\rm odd}}^\infty{16\over\pi^2 k^2}={1\over 2\pi}\cdot 2\pi=1\ ,$$
so that
$$\sum_{k\geq 1\ {\rm odd}}^\infty{1\over k^2}={\pi^2\over 8}\ .$$
It follows that
$$\zeta(2):=\sum_{k=1}^\infty{1\over k^2}=\sum_{k\geq 1\ {\rm even}}^\infty{1\over k^2}+\sum_{k\geq 1\ {\rm odd}}^\infty{1\over k^2}={1\over4}\zeta(2)+{\pi^2\over 8}\ ,$$
which finally gives $\ {\displaystyle\zeta(2)={\pi^2\over 6}}$.
