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.