According to quantum mechanics each state has a specific shape. So, how does the electron get into that shape of the orbital?
Electron doesn't 'get into' the shape of the orbital.
An atomic orbital is a mathematical function that describes the wave-like behavior of either one electron or a pair of electrons in an atom. This function can be used to calculate the probability of finding any electron of an atom in any specific region around the atom's nucleus. The term may also refer to the physical region or space where the electron can be calculated to be present, as defined by the particular mathematical form of the orbital. (wikipedia)
This means that Atomic orbitals are just areas around the nucleus of the atom where electrons might be found. As thought earlier, electrons do not revolve around the nucleus like planets revolve around the sun. Due to Heisenberg's Uncertainty Principle you can't know with certainty both where an electron is and where it's going next. We can only find probability of a an electron being in an area.
How do we find this area? Well, suppose you had a single hydrogen atom and at a particular instant plotted the position of the one electron. Soon afterwards, you do the same thing, and find that it is in a new position. You have no idea how it got from the first place to the second. You keep on doing this over and over again, and gradually build up a sort of 3D map of the places that the electron is likely to be found.
In the hydrogen case, the electron can be found anywhere within a spherical space surrounding the nucleus. The diagram shows a cross-section through this spherical space. This is the atomic orbital of Hydrogen ($1s$). 95% of the time (or any other percentage you choose), the electron will be found within a fairly easily defined region of space quite close to the nucleus.
I am not sure what you are asking about excited electrons so I'll just give a brief description about it.
Orbitals are grouped in zones at different distances from the atomic center. Electrons in zones close to the center are lower in energy than electrons in zones at greater distances from the center. According to Bohr, the amount of energy needed to move an electron from one zone to another is a fixed, finite amount. These zones are known as energy levels (or sometimes called electron shells). $1s$ orbital, the lowest energy level, can hold 2 electrons.
At the next energy level, there are four orbitals; a $2s$, $2p^1$, $2p^2$, and a $2p^3$. Each of these orbitals can hold 2 electrons, so a total of 8 electrons can be found at this level of energy. In larger and larger atoms, electrons can be found at higher and higher energy levels (e.g. $3s$ and $3p$).
It is possible for electrons to move between energy levels. When supplied energy, the electron becomes excited, and promptly moves out of its lower energy level and takes up a position in a higher energy level.
This situation is unstable, however. Almost immediately the excited electron gives up the extra energy it holds, usually in the form of light, and falls back down to the lower energy level again.