In the original Roman calendar, the year began in March, so December (from Latin 'decem' = 10) was the tenth month. Before Julius Caesar, March, May, July and October had 31 days. (Of course, 'July' at that time was called Quintilis - the fifth month - it became 'July' only later, to honour Julius Caesar.) All the rest had 29 days, except February which was the last month. This comes to a total of 355 days, so every two years an extra 22 or 23 days had to be added.This was done by inserting a new month called Intercalis, starting from February 24th and lasting 27 or 28 days. Over a 4-year period, then, a series of 355, 378, 355 and 377-day years existed. The 4 days too many that this system created were simply adjusted 'out of sight' from time to time!
Julius Caesar devised a system in which 365 days would replace 355 and an extra leap-day would straighten things up every fourth year. The ten additional days were shared out among the existing months, so January, March, May, July, October and December had 31 and the rest had 30, with February on 29 normally and 30 in leap years. Sextilis - the sixth month - was later renamed in honour of Augustus. Clearly, he could not be granted a shorter month than Julius Caesar, so a day was 'stolen' from February to bolster his month! And which day was taken? Well, the very last day of the year...namely February 29th or 30th. Thus, it now has only 28 or 29 days.