ipad mini icloud replacement

I know there is a way to replace the icloud in iphones and ipads that are on and working. I have done it once about a year ago. But I can not find the procedure anywhere now. Basically it will allow another account to replace the one on the ipad . Problem is , once your restore the ipad, the original account comes back. I have a perfectly good mini , but it keeps popping up the icloud password challenge. Any one know the procedure or can point me in the right direction?
Thanks in advance, Lenny