Electrons around an atom are distributed by PAIRS non-bonding and shared ones.
The sum of shared and unshared electrons around an atom must be 2, 8 or 18. The most common situation is eight: OCTET RULE
To write the structure of a molecule (NH3 for example) the following rules must be followed:
1. The central atom is chosen (never hydrogen). Generally the least electronegative (which has the least "cost" to share electrons).
2. The valence electrons (outermost) of all atoms are counted (1 x N = 5, 3 x H = 3, total 8 electrons or 4 pairs).
3. Bonds are formed between the central atom and the peripheral ones.
4. The "excess" electrons are placed on the atoms as unshared pairs (never in hydrogen).