How do sodium and chloride ions hold together in a solid crystal?
The ions are held together by strong electrostatic forces.
Ions with unlike charges attract each other.
The positive Na⁺ ions attract the negative Cl⁻ions.
But they repel other Na⁺ ions, because ions with like charges repel each other.
As a result, each Na⁺ will try to surround itself with as many Cl⁻ ions as possible. It can fit six Cl⁻ ions around itself.
Also, each Cl⁻ will try to surround itself with as many Na⁺ ions as possible. Again, it can fit six Na⁺ ions around itself.
The ions arrange themselves in the shape of a cube.
This pattern is repeated throughout the crystal.
The pattern is not open, as in the above diagram, because the oppositely-charged ions "want" to get as close to each other as possible.
They are, in effect, touching each other, as in the picture below.
Note: There is an Na⁺ ion "hidden" in the centre of the cube.