Why do electrons occupy the space around nuclei, and not collide with them? We all learn in grade school that electrons are negatively-charged particles that inhabit the space around the nucleus of an atom, that protons are positively-charged and are embedded within the nucleus along with neutrons, which have no charge. I have read a little about electron orbitals and some of the quantum mechanics behind why electrons only occupy certain energy levels. However...
How does the electromagnetic force work in maintaining the positions of the electrons? Since positive and negative charges attract each other, why is it that the electrons don't collide with the protons in the nucleus? Are there ever instances where electrons and protons do collide, and, if so, what occurs?
 A: An intuitive way is to think of matter waves.  If the electron were a point particle, it would have to start from a definite position, say somewhere on its orbit, and all of it would feel
the electric attraction to the nucleus and it would start falling just like a stone. It could not find a stable orbit like the moon does since it is charged and whenever it accelerates it gives off electromagnetic radiation, like in a radio antenna transmitting radio waves.  But then it loses energy, and cannot maintain its orbit.
The only solution to this is if the electron can somehow stand still.  (Or achieve escape velocity, but of course you are asking about the electrons in the atom, so by hypothesis, they have not got enough energy to achieve escape velocity.)  But if it stands still and is a point particle, of course it will head straight to the nucleus because of the attraction.
Answer: matter is not made of point particles, but of matter waves.  These matter waves obey a wave equation.  The point of any wave equation, such as $${\partial^2f\over \partial t^2} = - k \;{\partial^2f\over \partial x^2}$$  (this, if $k$ is negative, is the wave equation for a stretched and vibrating string) is that the right hand side is the curvature of the wave at the spot $x$, and the equation says the greater the curvature, the greater is the rate of change of the wave at that spot (or, in this case, the acceleration, but Schrödinger used a slightly different wave equation than de Broglie or Fock), and hence the kinetic energy, too.
There are certain shapes which just balance everything out: for example, the lowest orbital is a humpy shape with centre at the centre of the nucleus, and thinning out in all directions like a bell curve or a hill.  Although all the parts of the smeared-out electron might feel attracted to the nucleus, there is a sort of effect which is purely quantum mechanical, a consequence of this wave equation, which resists that: if all parts approached the nucleus, the hump becomes more acute, a sharper, higher peak, but this increases the left hand side of the equation (greater curvature). This would increase the magnitude of the right hand side, and that greater motion tends to disperse the peak again.  So the electron wave, in this particular stationary state, stays where it is because this quantum mechanical resistance exactly balances out the Coulomb force.
This is why quantum mechanics is necessary in order to explain the stability of matter, something which cannot be understood if everything were made of mass as particles with definite locations.
A: In fact the electrons (at least those in s-shells) do spend some non-trivial time inside the nucleus.
The reason they spend a lot of time outside the nucleus is essentially quantum mechanical. To use too simple an explanation their momentum is restricted to a range consistent with being captured (not free to fly away), and as such there is a necessary uncertainty in their position.
An example of physics arising because they spend some time in the nucleus is so called "beta capture" radioactive decay in which
$$ e + p \to n + \nu $$
occurs within the nucleus. The reason this does not happen in most nuclei is also quantum mechanical and is related to energy levels and Fermi-exclusion.

To expand on this picture a little bit, let's appeal to de Broglie and Bohr. Bohr's picture of the electron orbits being restricted to a set of finite energies $E_n \propto 1/n^2$ and frequencies can be given a reasonably natural explanation in terms of de Broglie's picture of all matter as being composed of waves of frequency $f = E/h$ by requiring that a integer number of waves fit into the circular orbit.
This leads to a picture of the atom in which all the electrons occupy neat circular orbits far away from the nucleus, and provides one explanation of why the electrons don't just fall into the nucleus under the electrostatic attraction.
But it's not the whole story for a number of reasons; for our purposes the most important one is that Bohr's model predicts a minimum angular momentum for the electrons of $\hbar$ when the experimental value is 0.

Pushing on, we can solve the three dimensional Schrödinger equation in three dimensions for Hydrogen-like atoms:
$$ \left( i\hbar\frac{\partial}{\partial t} - \hat{H} \right) \Psi = 0 $$
for electrons in a $1/r^2$ electrostatic potential to determine the wavefunction $\Psi$. The wave function is related to the probability $P(\vec{x})$ of finding an electron at a point $\vec{x}$ in space by
$$ P(\vec{x}) = \left| \Psi(\vec{x}) \right|^2 = \Psi^{*}(\vec{x}) \Psi(\vec{x}) $$
where $^{*}$ means the complex conjugate.
The solutions are usually written in the form
$$ \Psi(\vec{x}) = Y^m_l(\theta,\phi) L^{2l+1}_{n-l-1}(r) e^{-r/2} * \text{normalizing factors} $$
Here the $Y$'s are the spherical harmonics and the $L$'s are the generalized Laguerre polynomials. But we don't care for the details. Suffice it to say that these solutions represent a probability density for the electrons that is smeared out over a wide area near around the nucleus. Also of note, for $l=0$ states (also known as s orbitals) there is a non-zero probability at the center, which is to say in the nucleus (this fact arises because these orbital have zero angular momentum, which you might recall was not a feature of the Bohr atom).
A: Here's the Feynman response I read in his opening paragraphs in his Feynman lectures: 
The reason a proton and electron simply don't crash into each other is that if they did, we would exactly know their position-assuming one of them is stable, which one is (the proton). If we knew their position, we would be highly unaware of the momentum, meaning it could be very large, essentially having more energy to escape. 
I have noticed this behavior to be similar in my opinion to how a gas in a piston reacts to exerted pressure.
The Heisenberg uncertainty principle essentially pushes back on the Coulomb force, but only probabilistically, so perhaps they could get close, but not completely close. Otherwise, our uncertainty of momentum would be infinite. Here's the relation :
$\Delta p_x \Delta x\ge \frac{\hbar}{2}$
Less uncertainty in position=more uncertainity in momentum. 
A: This was the basic reason for the invention of quantum mechanics.
Simple mechanics with electromagnetism do not work in atomic dimensions, particularly with the charged electrons. Classical electromagnetism would have the electrons radiate energy away  because of the continuous acceleration of a circular path and finally fall in the nucleus.
So the answer is : because in the microscopic world nature  follows quantum mechanics equations and not classical mechanics equations. Quantum mechanics equations  include electromagnetic fields, and their solutions are stable and allow for the existence of atoms, which is what we experimentally observed to start with.
