Electrons do repel other electrons in an atom. This repulsion is a fundamental force known as the electromagnetic force, which acts between particles with electric charge, such as electrons. However, the reason electrons can still occupy the same atom despite their mutual repulsion is due to the presence of other forces that come into play.
Within an atom, electrons are arranged in different energy levels or orbitals around the nucleus. These energy levels correspond to specific distances from the nucleus. The electrons occupy these energy levels in a way that minimizes their overall energy.
The behavior of electrons in atoms is governed by quantum mechanics. According to the Pauli exclusion principle, no two electrons within an atom can have the exact same set of quantum numbers. This means that within a given energy level or orbital, electrons must have different spins. The spin is a fundamental property of electrons, and it affects their behavior.
The combination of the electromagnetic force and the Pauli exclusion principle determines the distribution of electrons within an atom. Electrons arrange themselves in various orbitals around the nucleus, and they occupy different energy levels and sub-levels, with specific rules for how they fill these orbitals.
The outermost energy level, known as the valence shell, is particularly important for determining the atom's chemical properties. In many cases, the valence shell is not fully occupied, and it is these valence electrons that participate in chemical reactions.
While electrons do repel each other, the specific arrangement of electrons within an atom allows for a stable configuration. The attraction between the positively charged nucleus and the negatively charged electrons helps to counterbalance the electron-electron repulsion, leading to a stable atomic structure.