What an ISO Week Number Actually Means (and Why Week 1 Isn't Always January 1)
The ISO 8601 standard defines week 1 of a year as the week containing the year's first Thursday (equivalently, the week containing January 4th) — because of this rule, the first few days of January sometimes belong to the last week of the previous year, and the last few days of December sometimes belong to week 1 of the following year.
This specific definition is precise but not intuitive on first encounter, which is exactly why ISO week numbers occasionally surprise people expecting a simpler "January 1st is always week 1" rule.
The core rule
ISO 8601 weeks always start on Monday, and week 1 of a year is specifically the week that contains that year's first Thursday. This is equivalent to saying week 1 is the week containing January 4th, since January 4th always falls within the first week that has a majority of its days in the new year.
Why early January can belong to the previous year's last week
If January 1st falls on a Friday, Saturday, or Sunday, the days from January 1st through that weekend belong to the final week of the previous year (week 52 or 53), not week 1 of the new year — since the following Monday starts the week that actually contains the new year's first Thursday.
Why late December can belong to week 1 of the next year
Symmetrically, if December 31st falls on a Monday, Tuesday, or Wednesday, those final days of December can belong to week 1 of the following year, since that week's Thursday falls in January.