I understand that current processing times for inland spousal sponsorship are ~15 months. If a spouse is currently residing in Canada on a temporary visa (student for example), and it expires before the spousal sponsorship application is complete and even before the IRCC has granted AIP via the letter, does the spouse still reside in Canada until the application is either approved or denied? or would the spouse have to leave back to their country of origin until such time the application is completed? (if for some reason securing another temporary visa or visa extension wasn't timely, those have lengthy processing times too I see).
apply to extend stay as visitor. Before the extension is approve, PA would be in implied state as visitor.
If you file an inland spousal sponsorship, there is an option to apply for OWP (currently you need to wait for AOR to apply for OWP). The application of OWP would give PA implied status as well (visitor in your case).
We have seen faster approval of sponsorship than 15 months. That really depends on PA's country and other factor but there is possibility that it can be done in less than the posted time.
And for inland application, PA stays in Canada. If you do nothing to extend his/her stay, (no extension no OWP) he/she will be staying with no status but he/she should not leave Canada during the process. Again, there is no reason why PA won't either extend his/her stay nor apply for OWP.