Start with hydrogen, atomic number 1, and line up the elements by proton count: 1, 2, 3 and so on. Every so often an element turns up that behaves like an earlier one. Lithium (3), sodium (11) and potassium (19) are all soft metals that fizz in water. Neon (10) and argon (18) are gases that react with almost nothing. The table breaks the line into rows so that these look-alikes stack up in the same column.
A column is a group, numbered 1 to 18. Elements in a group have the same number of valence electrons, the outer electrons that react, which is why they behave alike. A row is a period, numbered 1 to 7, and the period number tells you how many electron shells the atom has. Metals fill the left side and the middle, nonmetals sit at the upper right, and a staircase of metalloids such as silicon runs between them.
Rows and columns mean different things, and mixing them up gives wrong predictions. Sodium and chlorine are both in period 3, with three shells each, but one is a soft metal and the other a poisonous green gas: sharing a row does not make elements alike. Sodium and potassium share a group, and they are alike. The order is by atomic number, not mass, which is why argon (39.95) comes before potassium (39.10): argon has 18 protons and potassium 19.
Think of it like this. The periodic table works like a calendar. Days run in number order, but the calendar wraps them into rows so every Monday lines up in one column. Elements run in order of atomic number, and the wrapping lines up elements that behave alike. Unlike a calendar, the rows have different lengths: 2, 8, 8, 18, 18, 32, 32.
Core idea. Ordering the elements by atomic number and wrapping the list into rows puts elements with the same number of valence electrons in the same column, so an element's position predicts how it behaves.