As the protein shows, carbon atoms always have 4 bonds, nitrogen 3, oxygen 2 and hydrogen 1. Carbon atoms need 8 electrons in their outer shell, but they only have 4. So they share 4 with other atoms. These types of bonds are called covalent. They are created by electrons spinning around two atoms.
Electrons spin in pairs.
Electrons stay in shells around the nucleus of the atom. The first shell needs 2 electrons. The second and third shells need 8 electrons. If an electron is missing, it is borrowed from the bonding atom. A pair of electrons is then shared by both atoms.