Technically speaking one does not know. And so it is reasonable to continue remembering the dead in prayer so long as you feel called to do so. Many pray for a period of time, then continue to remember that person on key dates (birthday, wedding anniversary, death date, all soul’s day, etc.). If they are no longer in purgatory, surely they will smile down at you for the thought, and the prayer can be applied to some other soul who is in need of it.
Also, it is my understanding that though the souls in purgatory can do nothing to help themselves, they may still be able to pray for us. So there is no reason not to ask for their intercession through the duration, either.
Sometimes people may recieve private revelation that a loved one has been released. It is up to the individual to try to discern the truth of such.