The Periodic Table is organized in such a way as to have elements with similar physical and chemical properties aligned in columns called Groups (or families). One of the major factors that controls an element's chemical and physical properties is the number of valence electrons in its outermost shell and the Groups have elements which each have the same number of valence electrons.
The metals (the left 2/3 of the Chart) tend to form ionic compounds by losing electrons. This is due to the fact that they have a low ionization energy, or a low electron affinity (both terms refer to the ease with which an atom can lose an electron). When the metal loses an electron it becomes a positively charged cation.
Nonmetals (the right 1/3 of the Chart) when they form ionic compounds do so by gaining electrons. This due to the fact that they have high ionization energies and high electron affinities (referring to their ability to collect electrons). When they do form ions, they are of negative charge and are called anions.
For so called Representative Elements (Groups 1, 2, 13, 14, 15, 16, 17, and 18) the number of electrons that can be lost (metals) or gained (nonmetals) is determined by the Group they are in. Metals lose enough electrons to have the same number of electrons as the previous noble gas. Nonmetals gain enough electrons to have enough electrons to have the same number as the next higher noble gas.