To get started:
Think of a violin string as an analogy: the ends are constrained, so it can have only certain tones...certain vibrational patterns and associated energies. it's energy levels are constrained to certain values...it's degrees of freedom are limited when the degrees of freedom are limited.
Another helpful analogy is to think of the electron as a wave...when it's in free space the wave is [almost] everywhere, it extends all over the place. But when attracted by a proton in a nucleus, for example, that wave is now localized...it's constrained and so its different from the free space case. And the constraint is also modified by the presence of other electrons and additional protons. Since the energy is contained in the wave, changing it's configuration via the presence of nearby particles changes the wave characteristic and likely energy levels. It's very unlikely for the electron to be found between allowed energy levels.
In contrast, a [truly] free electron can take on any energy level. But when it is part of an atom or a larger structure, it's constrained...it's degrees of freedom are determined and limited by the whole structure. [ Just like you cannot stand up if I place you in a small square box.]
So an electron's energy levels and degrees of freedom are determined by the numbers of protons in the nucleus as well as the particular structure of a lattice, as examples. The Schrodinger wave equation describes these.
For a 'particle' to absorb a photon you need internal degrees of freedom which can be excited. Complex particles can do this; elementary particles [w/o constitutent components] cannot. A free electron can't absorb a photon since it has no inner degrees of freedom. An electron bound in an atom can because the whole atom (proton-electron bound state) provides these inner degrees of freedom.
Electrons behave very differently in different bound states...because their energy levels are constrained by their surroundings. They take on different apparent masses, different sizes, etc, whether in an atom, a lattice, and especially graphene where they appear to have virtually no mass...! If you place an electron in a potential well, it takes on the size of the 'enclosure'...and is thereby constrained; only certain standing waves are 'allowed'...those with zero amplitude at the boundaries.
Wikipedia has a decent,short explanation:
...Quantized energy levels result from the relation between a particle's energy and its wavelength. For a confined particle such as an electron in an atom, the wave function has the form of standing waves. Only stationary states with energies corresponding to integral numbers of wavelengths can exist; for other states the waves interfere destructively, resulting in zero probability density.
http://en.wikipedia.org/wiki/Energy_level#Intrinsic_energy_levels
This means the probability density of an electron in a nucleus of, say, hydrogen, is zero. My favorite explanation of a particle:
There is not a definite line differentiating virtual particles from real particles — the equations of physics just describe particles (which includes both equally). The amplitude that a virtual particle exists interferes with the amplitude for its non-existence; whereas for a real particle the cases of existence and non-existence cease to be coherent with each other and do not interfere any more. In the quantum field theory view, "real particles" are viewed as being detectable excitations of underlying quantum fields
Why particles exist, why we have the particles we observe, why they have certain characteristics and not others, why all particles exhibit wave particle duality, is because...well, it's just that way!