The best thing to do is what's best for your daughter. At minimum, this question is complicated, and so the best situation for your family may not be what's best for any other family. First, take a look at your daughter's life. Is she (a) happy, (b) performing well academically, and (c) getting the recommended medical attention (dental, physicals, vaccinations, etc) to be healthy? If she's doing well mentally, physically, and emotionally, you might need to just let your daughter remain with your mom for the next three years-- any attempt to move her now could cause more harm than good. If you're just not sure about how she feels, ask her how she's doing, speak with her teachers, and her doctor.
However, if you feel your mother isn't the best case, either because she's not doing well in school, is constantly sick, or seems unhappy/depressed, you may need to take aggressive action. I'd like to mention at this point, that doing anything to remove your daughter from this situation will be considered hostile by your mother, and you're likely not going to maintain a good relationship with her. This sacrifice might be necessary if it's for the good of your daughter, but remember, if she's really attached, it's likely going to cause emotional stress. You might need family therapy once you get her back, as well as a rehabilitation program. What I mean by "rehabilitation", is to start off with the "same rules" that your mom had, and gradually reintroduce the rules you expect her to abide by. It will be challenging for both you and her, and will take time. She may hate you simply for removing her, so expect resistance.
As far as getting her back, this will depend on the legal status of your daughter, and your legal relationship with her. If you've retained legal guardianship, simply asking for her back is sufficient. You can involve the police if necessary, because keeping a minor somewhere against your will is basically kidnapping, family or otherwise. If you don't have legal guardianship, you'll have to go through the courts to regain guardianship, unless you can argue your case with Child Protective Services. If the situation is dire, CPS can keep your child (relatively) safe while you work on getting legal guardianship back. I'd recommend against CPS, unless her health is endangered.
You can see, however, that no matter what you do, involving the police, CPS, or the legal system may cause financial burdens on yourself and your family, and will almost definitely breed animosity between you, your mother, and your daughter. Make sure that your decision is in your daughter's best interest. Ask yourself, your daughter, and a professional therapist/psychiatrist. It's difficult to gauge how your daughter will respond to anything you do, and you're doing this for her, so make sure that it's the best thing for her, even if she doesn't see it that way.
If she can safely stay with your mother for the next three years, you can always work to start a fresh relationship with your daughter once she's moved out of your mother's house and is living on her own. You've also mentioned that your mother isn't in the best of health. This can be an argument in courts for getting your daughter back, even if you don't currently have legal guardianship.