In order to find the possible ways of an how an electron acts in the presence of a proton we solve the Schrodinger equation with a coulomb potential, $\frac{k q}{r}$. At the outset of solving an equation, from a strictly mathematical viewpoint, the equation you are solving might have no solution, 1 solution or infinitely many solutions, and also the solutions might be continuous or discrete. That is, when we solve for the possible energies of system the energy might be able to only be one value, any value, or some particular discrete values. In the case of the Schrodinger equation for a hydrogen atom, it turns out that it only takes on the particular discrete values:
$E = \frac{-13.6 eV}{n^2}$
where n is an integer (and not equal to zero). So the lowest energy level an electron can have in this bound state is $-13.6eV $, it just can't go any lower. Its sort of like a building with definite floors to it, there just isn't anyway to be 'in-between' the levels. I want to emphasize that it is crucial we treat the electron quantum mechanically - 'classically' treating the electron like a point particle in the presence of a coulomb potential the electron spirals inward towards the nucleus. Thus the fact that an electron stays in its orbit is fundamentally different than way the earth stays in its orbit.
Now at this point, many people go on to say something about the uncertainty principal forbidding an electron to have definite position and momentum which forbids the electron from ever being so localized so as to be right at the site of the nucleus. As far as I can tell these arguments are simply false since an electron can actually sometimes fall into a nucleus to be annihilated, see electron capture - http://en.wikipedia.org/wiki/Electron_capture. So in principal you can have a process where the electron does fall into the nucleus to become annihilated. The thing is, the force that mediates this process is not the electromagentic force, its the 'weak' force which got its name for obvious reasons - its hardly noticeable over distances much bigger than $10^{-17}m$ (see http://en.wikipedia.org/wiki/Weak_interaction) which is much much smaller than the Bohr radius at $\sim 10^{-11}$ which is a rough way of thinking of how far the electron is from the nucleus at the lowest energy level ($n=1$).
In short, the dominant force that governs an electron in the presence of a proton is the electromagnetic interaction which only allows particular energy levels which are very stable. There are smaller, subdominant forces that allow other processes, but these are weak which in quantum mechanical terms means the processes governed by the weak force are very rare.
I'm not sure how much background you have, so let me know if you want more information in one direction or another.