Why do the free electrons in N-type want to diffuse? I'm trying to understand how a diode works and for this I've used(among other resources) the book written by Albert Malvino, Electronic Principles.
Everywhere I read about this topic, it says that when the N-type and P-type semiconductors are joined together, the free electrons from the N-type diffuse to the P-type.
I don't understand why is the diffusion happening.
The book Electronic Principles contains an attempt to explain this and states that the electrons diffuse because they have the same charge and they repel each other, but in my understanding the P-type and the N-type semiconductors have a neutral charge, because the number of positive charges (protons in the nuclei) is equal to the number of negative charges (free electrons and covalent bonds electrons), so the electrons repeling each other can't actually be the cause of the diffusion.
 A: The answer lies in a thermodynamic argument. The diffusion is a spontaneous process that occurs when particles with random motions are not uniformly distributed. The electrons in the 
conduction band in the n region are much more numerous that in the p junction. They will naturally tend to balance the concentration from the n junction to the p junction since the equilibrium tends to be the state with maximum disorder ie maximum entropy. 
A good visual picture of how the diffusion process occurs is in this video at 4'50.
https://www.youtube.com/watch?v=JBtEckh3L9Q
So the answer to what causes diffusion is thermal motion of quasi free electrons.
A: A book on semiconductor devices in general, like this one (e.g. section 2.7), may help. Also, just look at the diagram at the right of this Wikipedia page.
In general, imagine that we're looking at a graph of different energies (usually shown on the $y$ axis) in this semiconductor. The big thing that you'll notice in a semiconductor is that the density of states $n(E)$ contains a band gap between the "valence" and "conduction" bands. In general, doping can introduce new states and thus modify those bands(1), but the general wisdom is that, with weak doping, mostly what you do is modify the density of electrons without changing $n(E)$ too much. Changing the number of electrons that there are means what? Changing the Fermi energy, which is the average energy to add new electrons to the system. This can change the majority charge carriers; see for example the chart at the bottom of this explanation of Fermi energies.
Basically the problem is that the new electrons that the $n$-type dopant introduces need(2) occupy higher-energy states in the conduction band. The $p$-type dopant introduces holes which suck up some of its own higher-energy states, so its electrons similarly occupy lower-energy states.
Well, what happens if you've got two semiconductors in contact with different Fermi levels? Higher energies are occupied on the left than the right, and what happens? Answer: some of the higher-energy electrons on the left "fall into" the lower-energy states on the right. Yes, this leaves a $+$ charge on the $n$-type side and a $-$ charge on the $p$-type side with an associated voltage. That voltage actually has a name; it's called the "diode drop", and I believe in silicon it's pretty consistently about 0.6 V. The result: on the right hand side all of your valence band is filled in; on your left hand side none of your conduction band remains, and you've got a "depletion region". But the Fermi energy isn't just some abstract thing that we have no access to; we can raise or lower it by shifting the voltages that either side is at.(3) Basically if you use a little voltage to counteract the difference in their intrinsic Fermi energies, then you return back to a current-carrying configuration, after you go above the diode drop -- this is why diodes work the way they do (no current under reverse bias or zero bias, but a current once you overcome the 0.6V diode drop).
Footnotes


*

*Here's a fun Nature article simulating some of those changes of $n(E)$ with increasing doping.

*They only "need" to do this on average. Thermal jitters "smear" out the occupations a bit, but on averaging the higher Fermi energy means higher-energy states tend to be occupied.

*This is the parameter $\mu$ that you always see in the FD function; it is the "chemical potential" of the electrons.

