Nitrogen, the central atom in ammonia, has five valence electrons. Each hydrogen atom, on the other hand, has one valence electron. To achieve a stable electron configuration, nitrogen shares its three valence electrons with the three hydrogen atoms through covalent bonds.
Each hydrogen atom contributes its single valence electron to form a covalent bond with nitrogen, resulting in three N-H covalent bonds. These bonds hold the atoms together and determine the molecular structure of ammonia.