How do reflections of a square wave cause ringing in transmission lines?
We'll start with what a square wave is.

A square wave is a bunch of sine waves added together.  You have a primary, and a bunch of harmonics added to it.  The harmonics are in a particular phase relationship to the primary.  The sum of all the waves is a square wave.  If you leave any of the sine waves out (or change their phase,) then the sum looks less like an ideal sine wave.

This image from the Wikipedia page illustrates it clearly:



Now, on to the reflections.

If your transmission line were terminated in a perfect resistor that doesn't match the line impedance (and there were no effects from capacitance or inductance) then the reflection would be a nice, sharp copy of your original square wave.

In any real circuit, you will have capacitances and inductances to deal with.

The inductance, capacitance, and resistance of your transmission line will interact with the inductance, capacitance, and resistance of the termination.  The result is an impedance that varies with frequency.

A square wave is a collection of sine waves of different frequencies, so different parts of it are more or less strongly reflected.  Some frequencies will be slightly delayed, and some won't.

The result is often that some part is reflected as a somewhat proper looking square wave while other parts are reflected differently enough that you can see the sine wave itself.

When neither end is properly terminated, then each sine in the square wave is reflected depending where exactly it "hits the end."  

Say you have a transmission line 1 meter long, and a wave one meter long.  In this case, there will be no reflection - the wave fits exactly in the transmission line.

Now keep the 1 meter transmission line, but change to a wave that is 67 centimeters long.  The wave doesn't fit exactly in the transmission line anymore.  Part of it will be reflected.

Put the one meter wave and the 67 centimeter wave into the same transmission line at the same time, and you will only see reflections from the 67 centimeter wave.

Now consider your square wave (made of waves of different lengths.)  Some parts will reflect more strongly than other parts.  If most of the sine waves reflect together, then you might get something that looks like a square wave.  You might also get a situation where only a few (or one) frequency reflects strongly - in which case you get something that looks like a sine wave as a reflection.  That's ringing.