An ionic compound is a giant structure of ions, called a lattice. The ions are arranged in a regular, repeating pattern, with positive and negative ions alternating through the structure. Sodium chloride is the example you need to know: sodium ions and chloride ions alternate in all three dimensions.
The ions are held together by strong electrostatic forces of attraction between oppositely charged ions. These forces act in all directions in the lattice, and this is called ionic bonding. If a diagram shows a regular lattice of alternating positive and negative ions, you can deduce that the compound is ionic.
You can work out the empirical formula from a model by counting the ions and finding the simplest whole-number ratio. If a model has 4 calcium ions and 8 chloride ions, the ratio is 1 to 2, so the formula is CaCl2. Sodium chloride has one sodium ion for every chloride ion, so its formula is NaCl.
Every diagram of a giant ionic structure has limits. Dot and cross diagrams show only the outer electrons and do not show the giant lattice. Ball and stick models show only a small number of the ions, and the sticks suggest solid bonds that are not really there. Two-dimensional diagrams cannot show the three-dimensional arrangement of the ions.