As you correctly state, Mia's grandfather tells her she has his permission to move on from this life if that's what she wants. Initially, that seems to make her decision for her, as she decides to die so she can join the rest of her now-dead family on the other side.
However, three important things then happen.
- Firstly, we see a flashback of Mia performing excellently at her audition for Juilliard, leading her to be very positive about her chances of getting in.
- Secondly, we see Mia and Adam breaking up, after reconciling with each other and realising how big the other's opportunities are.
- Thirdly, we see Adam visiting Mia and giving her the acceptance letter from Juilliard and playing music from her favourite composer, Beethoven.
The combination of these actions are enough to show Mia that, although she desperately wants to join her family on the other side, she has so much to live for. It's ultimately this realisation that makes her stay.
It's also worth noting two more things. Firstly, the movie's ending was a departure from the book, where it is heavily implied she got in, but not categorically stated (although a sequel was released sometime later proving she did in fact live). Secondly, many critics strongly disliked the ending as it did appear as if she was comparing death with Juilliard.
So to answer your question - she stayed because she chose to stay. It wasn't predestined, it wasn't always meant to be that way. If she had wanted to give up, she could have. But between Adam and Juilliard, she simply realised life had so much left in store for her, so she chose to live.