Generally speaking, 29th February occurs once every four years, because there aren’t precisely 365 days in a year but approximately 365 and a quarter.
That means it takes the earth 365 and a quarter days to go round the sun and complete an astronomical year.
This extra day every four years allows the man-made calendar to catch up with the astronomical calendar.
However, because it isn’t quite a quarter day that needs to be added, we only need leap days 97 years (not 100) out of 400.
It is for this reason that we have this formula. There’s a leap year every year that’s divisable by four unless that year is divisable by 100.
If it is divisable by 100, it would be a leap year if that year was also divisable by 400 (as 2000 was). So although 1900 was divisable by four, it wasn’t a lear year.