In 1869 Dmitri Mendeleev published a paper entitled, "On the Relationship of the Properties of the Elements to their Atomic Weights." In that paper he produced an ordered arrangement of the elements, listing them in order of increasing weight and arranging them in groups based on similar chemical properties. Although many decades remained before the details of atomic structure would be discovered, Mendeleev's table already organized elements in terms of their valence.
Elements and Atomic Weight
In Mendeleev's time atoms were thought to be indivisible, unique entities. Some were heavier than others, and it seemed reasonable to order the elements by increasing weight. There are two problems with this approach. First, measuring weight is a tricky task, and many of the accepted weights of Mendeleev's day were not correct. Second, it turns out that atomic weight is not really the relevant parameter. Today's periodic tables place the elements in order of their atomic number, which is the number of protons in the nucleus. In Mendeleev's time, protons had not yet been discovered.
Elements and Chemical Properties
Mendeleev wrote that "arrangement according to atomic weight corresponds to the valence of the element and to a certain extent the difference in chemical behavior." The valence, in Mendeleev's understanding, was an indication of the ability of an element to combine with other elements. Mendeleev combined the order of atomic weight with common valences to organize the elements in a table. That is, he organized the elements in groups according to their chemical characteristics. Because those properties repeat every so often, the result was a periodic table in which each vertical column, called a group, contains elements with similar characteristics, and each horizontal row, called a period, arranges the elements by weight, increasing from left to right and top to bottom.
About 50 years after Mendeleev's first periodic table, scientists discovered the atom was built around a nucleus with positively charged protons and neutral neutrons -- both of which are relatively heavy. The positively charged nucleus is surrounded by a cloud of negatively charged electrons. The number of protons -- also called the atomic number -- typically matches the number of electrons. It turns out that the number of electrons an element has largely determines its chemical properties. So the proper order in the periodic table is determined by the number of electrons, not weight as Mendeleev originally proposed.
The electrons in the cloud surrounding an element's nucleus are arranged in layers, called shells. Each shell has a specific number of electrons it can hold. When each shell is filled a new shell is added until all of the electrons are accounted for. Electrons in the outermost shell are called valence electrons, because it is their interactions that determine the chemical properties of an element. The columns that were set up to group elements by similar chemical properties turn out to be the exact same columns defined by the number of valence electrons. Elements in group 1A have only one valence electron, and each group A column to the right adds one more valence electron. Organization gets a bit murky with the Group B elements, but each of them is also grouped by their number of valence electrons.