According to what criteria was the periodic table of elements ordered?
I do not address the question of history, of Mendeleyev's investigations, that is answered in How was Mendeleev able to develop his table?

Modern understanding of basic principles follows. Let us have a piece of periodic table

  ... A0 B0 ...
  ... A1 B1 ...
  .............


Element "B0" must have the next atomic number after "A0", i.e. one more electron. It is different chemically, although may have (albeit not necessarily) similar physical properties.

Element "A1" must be chemically similar to "A0", although physical properties may differ significantly (as a general rule, ".1" elements are denser than ".0"). It happens that for each element there exist its "analog" in the next period, that has similar chemical properties (based on similar outer-shell electron configuration). This pattern, once noticed, permitted for good predictions (search for Mendeleyev's "eka" elements in Internet for more information).

Periods have different lengths. Analog's atomic number may be 8, 18, or 32 ahead off the prototype's atomic number (the number of electrons expended to "raise" all the configuration one shell up). This difference is due to quantummechanical effects.