Your residence permit can lapse for three reasons:
If you give up your residence and leave Denmark
If you fail to enter Denmark no later than six months after you were granted a residence permit
If you stay outside Denmark for an extended period of time
Your residence permit will automatically lapse if you no longer have a residence in Denmark - that is, if you sell your home or terminate the rental contract of your home, and you are no longer registered at a Danish address with the Central Office of Civil Registration (CPR office) - and if you leave Denmark.