Electrons in atoms are arranged in discrete shells around the nucleus. The first shell holds 2 electrons and subsequent shells hold up to 8 electrons each following the octet rule. Ions form when atoms gain or lose electrons to fill or empty their outer shell, becoming negatively or positively charged. Ionic bonds occur when oppositely charged ions attract. Covalent bonds occur when atoms share electrons in molecular orbitals. Nonpolar covalent bonds share electrons equally while polar covalent bonds have an unequal electron distribution making one end partially negative and the other partially positive. Hydrogen bonds form between the partially positive hydrogen of one polar molecule and the partially negative end of another.