This is where things get a little more complicated. When a domain expires (ie not renewed before the expiry date), it now enters an "auto-renew grace period". The domain can still be fully functional during this period (although the registrar can disable DNS on the domain during this period it if they choose). The registrar is charged money when the domain enters auto-renew grace. However we can get that money back by "deleting" the domain. Which is obviously what we would do if the registrant did ultimately not renew. Domains are in this auto-renew grace period for 45 days. If we don't delete the domain by the end of the 45 days, it goes back to registered status.
If the registrar "deletes" the domain during the auto-renew grace period, it then goes into "redemption grace" status for an additional 30 days. During this time DNS does not work at all, however the domain is still available for renewal. After the 30 days of redemption grace are up the domain is gone for good and it goes to TBR.
So in theory, we could wait until the 45th day before we "delete" the domain, and then wait another 30 days, before finally deciding to renew. Or alternatively, some registrars may just delete the domain right away after it "expires", and then there are only 30 days of redemption grace.
So basically, depending on the registrar, the period after a domain expires while you are still able to renew it is at least 30 and at most 75 days.
To be on the safe side.. if you insist on waiting until the last minute, I would do it after 29 days. I would hazard a guess that many (if not most) reps at registrar's won't really know how their system works, and how much time you really have... so it's better to be on the safe side.