To answer your question as briefly as I can, during a leap year where Rosh Hashannah begins on Tursday and the year is "Chaser" - "Deficient" meaning 383 days long, then Pesach begins on Sunday, and there will be 55 Shabatot in total. I am also assuming that we are talking about Galut readings, as Israel readings have slightly different rules.
We have 54 parshiot. One of them, namely V'Zot Habracha is never read on Shabbat, b/c Simchat Torah is never on Shabbat. So, that leaves 53 parshi'ot that we must be concerned about.
Two Shabbatot are occupied by Hol Hamo'ed Pesach (or, in this case, since Pesach began on Sun., it would be 7th day of Pesach), and Hol Hamo'ed Succot. So, of the 55 Shabatot, 2 are unsuable for the regular parsha. That leaves us with 53 Shabbatot for the 53 parshi'ot making it an exact fit where no parshiot are doubled.
From this calculation, I think you may be able to deduce how all the others fit in during non-leap years.
You should read this interesting paper that discusses doubling, separating and even "halving" the parshiot.
Incidentally, this year is one of the rare occasions where Matot and Mas'ei are read separately. If you read the article mentioned above, you will find charts that explain the conditions needed to make Matot and Mas'ei separate.