Quite easily, actually. An ion is produced when an atom, due to its grouping on the periodic table of elements, loses, gains, or shares electrons between itself and another atom. The factor that determines what the atom will do is the number of electrons available in the outer electron orbital. Calcium, for example, is in group 2, on the far left of the periodic table. What this means is calcium has 2 electrons it has in its outer electron orbital. It is easier for calcium to lose those electrons to another atom than to go hunting for 6 more electrons to complete the electron orbital, so it willingly donates them to another atom, such as chlorine. When this happens, calcium has more positive charges in the nucleus than it does negative charges, so it has a charge of +2. Chlorine has 7 electrons in its outer electron orbital, has room for 1, and will gladly accept one of calciums electrons to complete its orbital. When that happens, chlorine now has more negative charges than positive charges and has a charge of -1.
If you dissolve calcium chloride into water, the two ions dissociate and mix between the molecules of water, into Ca+2 and Cl-1 ions.