Canada's Deportation Rules

When, exactly, will Canada deport someone, and when will they decide to keep the person in their own country? Assuming there’s minimal political interest in the case, and the normal laws hold sway, of course.

As a rider, will Canada decide to punish foreign criminals in its own prisons instead of deporting them?