Once we know that electrons occupy orbitals labelled by quantum numbers, the next question is practical: in a real atom, which orbitals get filled, and in what order? The arrangement of electrons in the orbitals of an atom is its electronic configuration, written by listing each occupied sub-shell with the number of electrons as a superscript, for example carbon as $1s^2\,2s^2\,2p^2$. Three rules govern the filling.
1. Aufbau principle. "Aufbau" is German for "building up". Electrons enter the lowest-energy orbital available first, then fill upwards. The energy order is set by the $(n+l)$ rule (Madelung rule): an orbital with a lower value of $n+l$ fills first; if two orbitals have the same $n+l$, the one with the smaller $n$ fills first. So $4s$ (with $n+l=4+0=4$) fills before $3d$ ($n+l=3+2=5$), even though $3d$ has a smaller $n$. The resulting order is $1s,2s,2p,3s,3p,4s,3d,4p,5s,4d,5p,6s,4f,5d,6p,7s$.
2. Pauli exclusion principle. No two electrons in an atom can have all four quantum numbers identical. Since an orbital is fixed by $n,l,m_l$, the two electrons sharing it must differ in $m_s$ — one spin up ($+\tfrac{1}{2}$), one spin down ($-\tfrac{1}{2}$). Hence an orbital holds at most two electrons, and they must be paired with opposite spins. This is why a sub-shell of $2l+1$ orbitals holds at most $2(2l+1)$ electrons.
3. Hund's rule of maximum multiplicity. When filling degenerate (equal-energy) orbitals of a sub-shell, electrons occupy them singly first, all with parallel spins, before any pairing begins. Pairing two electrons in the same small orbital costs energy (electron-electron repulsion), so spreading out is favoured. For nitrogen ($2p^3$) all three $p$ electrons are unpaired in separate orbitals; only at oxygen ($2p^4$) does pairing start.
To write the configuration of an ion, first write the neutral atom, then add electrons (for an anion) into the next orbital, or remove electrons (for a cation) — and here is a key subtlety: electrons are removed from the orbital with the highest $n$ first, not simply in the reverse of the Aufbau order. So for iron, $\text{Fe}=[\text{Ar}]\,3d^6\,4s^2$, but $\text{Fe}^{2+}=[\text{Ar}]\,3d^6$ — the $4s$ electrons leave before the $3d$ electrons, because $4s$ has the higher principal quantum number.
Extra stability of half-filled and fully-filled sub-shells. Configurations in which a sub-shell is exactly half-filled ($p^3,d^5,f^7$) or completely filled ($p^6,d^{10},f^{14}$) are unusually stable, thanks to their symmetrical charge distribution and greater exchange energy (the stabilising energy gained when electrons of parallel spin swap places). This stability is large enough to override the simple Aufbau order in a few elements. Chromium is $[\text{Ar}]\,3d^5\,4s^1$ (not $3d^4\,4s^2$) and copper is $[\text{Ar}]\,3d^{10}\,4s^1$ (not $3d^9\,4s^2$): one $4s$ electron shifts into $3d$ to reach the extra-stable half-filled or fully-filled $d$ sub-shell. These two are the classic NCERT exceptions you must remember.
From the configuration we can read off the number of unpaired electrons (which governs magnetic behaviour — paramagnetic if any are unpaired, diamagnetic if all are paired) and the valence-shell arrangement that drives the element's chemistry. The configuration is therefore the bridge between the abstract quantum numbers and the real periodic table.