What is the purpose of having guitar pickups out of phase with each other?
It might help to understand what phase is and what people mean when they say "in phase" or "out of phase". Technically, phase is the amount of a wave that elapsed relative to some arbitrary point in time. If you consider a simple sinusoidal wave a phase of 0 degrees represents some arbitrary starting point of the wave, every time the wave passes through that same amplitude it's phase has increased by 180 degrees. Lets say we pick an amplitude of 0 as the starting point and we have a simple sinusoidal wave. At a phase of 180 degrees it will pass through zero again, but moving in the opposite direction, and at a phase of 360 degrees it will pass through zero again and be moving in the same direction as it was as 0 degrees.
If two waves are equal and "in phase" they are passing through the same amplitudes at the same time. When two waves are equal and in phase they sum to produce a wave that is twice the amplitude of either of the original waves. We call this constructive interference.
If two waves are equal and 180 degrees out of phase they are passing through opposite amplitudes at the same time. So when one wave is +1, the other would be -1. When two waves are equal and 180 degrees out phase they sum to produce a wave that always has zero amplitude. This is called destructive interference.
If we have an idealized setup, where two pickups are in the same spot on a guitar string, then their output should be exactly the same. In this setup, if they're wired in phase their signals will add and you'll get an output signal that is twice the volume of just one pickup or the other. If you wire up this idealized pickup scenario out of phase you'd hear nothing at all.
But in reality guitar pickups cannot be situated like this. They're always sampling a different part of the string (sometimes slightly as is the case of side-by-side pickups in a humbucker arrangement, sometimes considerably as is the case with a neck and bridge pickup). So the signals they're producing aren't exactly the same. That means combining them out-of-phase doesn't silence the output. Instead you get some interesting destructive interference happening that produces an output that's usually described as "quacky". It's missing some frequencies.
If you combine them in phase things don't get twice as loud, but they do get louder than either pickup on their own, as the same frequencies that were aligning to cancel out in the out-of-phase arrangement, align and add in a constructive interference pattern.
Having pickups out of phase results in some more interesting sounds than what standard in-phase wirings can achieve. One of the most notable guitarists to use this sound is Jimmy Page of Led Zeppelin (among others) who had a myriad of wiring options available on his legendary Les Paul. Out of phase tones have a sort of hollow sound due to some frequency cancellation.
Speaking of that, from a physics standpoint having two pickups out of phase results in some signals produced cancelling out other frequencies. The more out-of-phase the pickups are, the more frequencies get cancelled, which makes the tone more unique and hollow. Also note that two (identical) signals that are 180 degrees out of phase with one another completely cancel each other out--but thankfully guitar pickups are at different positions on the body and relative to the strings--so that would almost never happen.
Note that the out-of-phase tone is not to be confused with the more hollow tones observed from a standard wired Fender Stratocaster at positions two and four. Some experts say these tones come from the characteristics of the single coil pickup along with the distances and position of those pickups relative to one another. The pickups are actually wired to be in-phase, but most guitarist mistakenly say they are out of phase.
A guitar whose pickups are in phase will typically sound different than a guitar whose pickups are out of phase.
This is because when electrical signals are combined, they can either reinforce each other, or cancel each other out.
Some guitars have a switch that reverses the phase of one of the pickups to create an in or out of phase condition.
I believe on the Strat, the middle pickup is wired up out of phase to provide hum cancellation.
Guitar pickups, in addition to amplifying the sound from the strings can also pick up other electrical currents, most especially 60Hz AC, that end up coming out of the amplifier as a humming sound. But, since these AC signals are primarily picked up by the coil windings, if you have a set of two windings that are reversed from each other, the AC signals end up being 180 degrees out of phase with each other and are thereby canceled out. Since the strings themselves are amplified using both the coil windings and the magnets, if the magnets are then placed opposite of each other (i.e. one pickup has north facing up while the other has south), the string signal ends up being doubled.
So, what you end up with is a stronger string single with less hum than you would otherwise have.
A better description of this can be found on the Wikipedia page for pickups: Pickup (music technology).