On every day that you are in the Schengen area, you must ask yourself this question: "Have I been in the Schengen area for 90 out of the last 180 days?"
If so, you must leave. If not, you can stay.
Of course, you can do that asking in advance, as part of your travel planning, because the passage of time is fairly predictable. But the basic rule is that you must have spent no more than half of the last 180 days in the Schengen area, and this needs to be true every day.
Here's another analogy. Imagine you have a garden with 90 flowering plants. At the start, every plant has a flower on it. When you pick a flower from a plant, the flower grows back 180 days later. You have to pick a flower every day you are in the Schengen area. If you run out of flowers, you have overstayed.
What that analogy shows is that when you "consume" a day out of the 90, you "get that day back" 180 days later. Each day is treated individually and independently. There is no magic reset at the end of a month or a year; the period rolls on for ever.