Here is an example of how it works guys.
Day 1 - January 1st you arrive in a Schengen Zone country such as Germany for example. From January 1st (Day 1) till midnight on June 29 (Day 180) you are only allowed to stay in the Schengen zone for a maximum of 90 days in that 180 day period.
If you stay for longer than 90 days in that period, you will have broken the visa regulations. You may be caught when you eventually try to leave, or you may be caught when you next try to re-enter (when you try to re-enter, passport control will be able to see computer records showing how long you had stayed in the Schengen Zone when you last visited).
Now, Say you arrived in a Schengen Zone country such as Germany on Jan 1 (day 1) and stayed till Jan 30 (day 30). On Jan 30, you leave and go to the UK for 21 days. Then you want to return to the Schengen Zone. When you re-enter the Schengen Zone, you can only stay for up to another 60 days in the 180 day period that started when you first entered back on Jan 1. The 180 day period will end on Jun 29, and no matter how many times you leave the Schengen zone, you must leave before Jun 29 or else you will be in breech of the visa conditions.
If you leave on or before Jun 29 (and have not stayed in the Schengen Zone for more than 90 days in that period between Jan 1 and Jun 29) then you can return to the Schengen Zone on Jun 30 and then get 'a new 180 day period' whereby you can stay legally for 90 days over the next 180 days.
So to understand. the 180 day period starts when you first arrive in the Schengen Zone. If you then leave the Schengen Zone after 30 days (for example) and then come back in 5 days later (for example), you do not get a new 90 days of stay or a new 180 day period.
Now the rule is a little confusing here, but hope I can clear something up easily. You arrive in Germany (Schengen Zone) on Day 1 (Jan 1). You have to leave by day 180 (Jun 29) or 90 days (whichever comes first). But stay you arrived Jan 1 and stay for 30 days (till Jan 30). You leave and do not return within the next 90 days since you left on Jan 30 (the day you last left). So, say you then come back to Germany (Schengen Zone) on Jun 1, you will now get a new 180 day period within which you can stay for a maximum of 90 days. This means, that if you stay away from the Schengen Zone for more than 90 days, then you will get a new 180 day period within which you can stay for 90 days.