In 1869 Mendeleev arranged the elements in order of atomic mass. He put them in rows so that elements with similar properties lined up in the same column. He left gaps for elements that had not yet been discovered and predicted their properties. When these elements were found, the predictions fitted well, which convinced scientists his table was useful.
Ordering strictly by atomic mass did not always work. A few elements ended up in a group with elements that were chemically different, so Mendeleev swapped their order. At that time nobody knew why this was needed.
The modern Periodic Table is ordered by atomic number, which is the number of protons in the nucleus. The number of protons rises by exactly one from one element to the next, so no swaps are needed. Argon has a higher relative atomic mass than potassium, but its atomic number of 18 is lower than the 19 of potassium. In the modern table argon is placed before potassium, in Group 0.
Each row of the table is called a period and each column is a group. Elements in the same group have the same number of outer electrons, which is why they have similar properties. Knowing about atomic number and electron arrangement explained the pattern that Mendeleev had spotted.