Can someone give a detailed explanation of what happens when a square wave passes through a high pass filter?
The question as it stands has an answer that depends on the square wave parameters and the filter characteristics.

Therefore you have to know at least the frequency of the square wave and the cutoff frequency of the filter. Moreover some details may differ if the filter is a simple one-pole passive RC filter or is more complex.

The comment you make in your question about non-linear filters is unclear. The term "filter", by the usual definition, refers to a linear device (unless you are analyzing non-linear effects in active filters). If you are dealing with a more complex signal processing device you should be more precise and add information.

Anyway, I'll assume that you are talking about a simple 1-pole passive RC filter like the following:







simulate this circuit &ndash; Schematic created using CircuitLab

The first thing to notice, as @Neil_UK said in a comment to your question, is that the output is across the resistor, not across the capacitor. 

If you took the output across the capacitor you would have a low-pass filter, instead! Maybe that was a trick question, otherwise you may have spelled it out in a wrong way in your post.

Assuming the output is across the resistor, you should think about the relative positions of the square wave frequency, let's call it \$f_s\$, and the filter cut-off frequency, let's call it \$f_c\$.

There are three relevant cases:


\$ f_s &gt;&gt; f_c\$
\$ f_s &lt;&lt; f_c\$
\$ f_s \approx f_c\$


The first is easy: if the square wave frequency lies well above the cut-off of the filter the harmonics of the wave will pass almost unaltered, therefore you'll have essentially the same signal at the output

The second is a little more complicated: since higher harmonics' amplitude decades with frequency (i.e. with the harmonics' order), most of the relevant harmonics of the signal fall in a frequency interval where the frequency response of the filter is growing linearly (on a Bode plot), so the filter acts as a (non-ideal) differentiator for the signal. In this case you'll get an output signal which is almost zero between signal edges, whereas you'll get spikes in correspondence to the square wave's edges.

The third case (\$f_s\$ near cut-off) is something in-between, especially if the fundamental component is just below cut-off.  The signal will be distorted: the fast-rising edges will pass, but the flat part will be attenuated, so you'll have an exponential decay shape between edges.

You didn't state whether the square wave has a DC component (DC offset), anyway even if present that DC level will be stripped-off the output signal, which will have no DC component in any case (thanks to @Gregory Kornblum for pointing this out in a comment).

The following are the results of an LTspice simulation in the three cases: