Transmission of a digital signal over a medium
Theoretically a square wave has infinite bandwidth but it still looks reasonably square even if the bandwidth is severely compromised. A square wave is "made from" a series of ever-increasing harmonics. See the picture below to get an understanding: -



On the right is a sinewave then as you look down you'll see that it grows into a square wave. If all we had was the sine wave and the third harmonic we would be able to "decode" this adequately.

This means we can send fairly pure digital data (very good looking waveforms with fast rise and fall times) over a very limited-bandwidth channel and decode them successfully. I had to put this pretty moving picture in: -

http://upload.wikimedia.org/wikipedia/en/thumb/5/50/Square_wave_frequency_spectrum_animation.gif/600px-Square_wave_frequency_spectrum_animation.gif

It shows the gradual evolution of a square wave from a sine wave and along with the spectrum.



ADDED SECTION

It's also worth pointing out that data is hardly ever a perfect square wave; more likely it is a quickly changing pulse waveform so, I'm also showing below the spectrum shape for a generalized pulse: -



For non 50:50 waveforms (i.e. non-square) both odd and even harmonics are generated. I've also shown the triangle spectrum - it is of considerable interest when the digital data is slew rate limited in order to restrict the bandwidth. Compare the spectral content between this and the square wave directly above. Picture taken from here