A few questions about the Fermi Level/Energy My first question is, how is the Fermi Energy for a material actually determined? I know this derivation, but it seems to say that the Fermi Energy is just based on the electron density (and maybe some effective mass) of the material. Is that really all that determines it?
Secondly, I'm trying to figure out how the interfaces of various materials work in terms of their bands, but it's not clear to me exactly what must be true in all cases (vs what is often but not necessarily true, or what is theoretically but rarely practically true). For example, Anderson's Rule starts by aligning the "vacuum levels" of the two materials, but then this article says that it's not a great idea to use the vacuum level, and the Anderson's Rule article says it's just not that accurate a rule, anyway. Similarly, it seems like the Schottky-Mott Rule isn't very successful either.
Additionally, I've read somewhere that the Fermi Level (the electrochemical potential, the sum of the chemical potential and electric potential) has to be continuous everywhere in both of the materials, so that results in the chemical potentials (i.e., the $T \neq 0$ Fermi Energies, which were normally different in the two materials) lining up, and that happens by having an electric potential difference across them. But this picture from wikipedia then seems to suggest that either what I just said is wrong, or the label should really be "Fermi energy" (or chemical potential) in their definitions. Which is it?
So, what can I always depend on and know is true in these situations?
 A: The answer to the 1st question:
I assume that your question is theoretical one.
Generally speaking, the Fermi energy is determined by the energy spectrum (or density of states) and the number of electrons we fix.
So it is difficult to describe the Fermi energy by using only a few parameters generally.
In the case of free Fermion, the band structure is simple, and it enables us to calculate explicitly.
Although general calculation is difficult as mentioned above, the effective mass tensor, hopping parameters, the spin-orbit coupling constant and the van Hove singularity are examples of the important parameters or properties. 
The answer to the 2nd question:
The Anderson's rule or Schottky-Mott rule are models.
Therefore, there must be differences between these models and the nature.
However, as far as I know, these models are not so bad at least to use them in order to list candidates of materials.
If you are the principal investigator of the mass production division of some semiconductor company, you should, of course, take much accurate way.
The answer to the 3rd question:
There is no wrong point in the figure.
It may help you that $q\Phi$ has the dimension of energy, not $\Phi$.(q is charge, $\Phi$ is the electric potential)  
A: The most useful discussions I found on this were Tung's page and Bardeen's 1947 article. There are a variety of problems with trying to theoretically predict how bands will align at a junction:


*

*Vacuum surface parameters like work function are only simple constants when considering the vacuum at least several nanometers away from a surface. So, we can't honestly use these numbers in a junction where the vacuum is extremely narrow (if it is even there at all).

*Physically there is an electric potential, and although it varies with position it must not have a discontinuity at the junction. You can count on this 100%. However, we find that it is continuous only when we look on the atomic scale. Looking on a larger scale there is an apparent discontinuity due to interface dipole.

*How much is the interface dipole? This depends a great deal on the choice of materials and how they chemically bond. The bonding structure is influenced by the method of creating the junction, and any processes done afterwards (e.g. annealing)...


It's worth noting that interface dipoles and such are also a problem for material-vacuum surfaces, and the material-vacuum "band alignment" (specified by work function or electron affinity) is also difficult to theoretically predict.
As a result, the state of the art in determining band alignment is an assortment of heuristic rules that sometimes work, and computationally intense density functional simulations that sometimes work. To reach the 0.1 eV accuracy level, however, it appears that all you can do is just empirically measure the band alignment in a real sample.
As I understand, though, one thing you can count on is that in a metal-semiconductor or semiconductor-semiconductor junction, the band offsets at the junction do not depend on doping. Likewise the semiconductor-vacuum electron affinity does not depend on doping.
(As to your last question on the heterojunction image, that is a picture of two semiconductors separated by a long distance, and with a voltage (Fermi level difference) applied between them so as to align their vacuum levels. As you say, once they go into contact the only way to keep the Fermi levels so different would be to drive a huge current through the junction.)
