Ionic compounds form when atoms gain or lose valence electrons to achieve stable electron configurations, forming oppositely charged ions that attract each other. Ions are arranged in repeating crystal lattices that give ionic compounds high melting and boiling points and make them brittle solids. Metals form metallic bonds through delocalized electrons that allow metal atoms to bond without transferring or sharing electrons.