The grappled condition ends if the grappler is incapacitated, or if an effect removes the grappled creature from the reach of the grappler.
Many DMs rule that anything that pushes, pulls or otherwise relocates either the grappler or grapplee will remove the grappled condition so long as the forced movement takes you out of the reach. I do not. Instead, I ask the grappler if they're trying to hold on, and then (if they are) I make a ruling on how hard that is, and how each part of the grapple (and the push/pull effect) is impacted if they hold on. This often requires me to think on my feet.
So, if you're grappling a tiny creature and it is hit by a push effect that moves it 10 feet, I think about that similarly to how hard it is to hold onto something the size of a watermelon that was hit hard enough to send it flying 10 feet. If you hold on, that object may take some extra damage, but if you're so much bigger than it, you might get knocked down, but you're not flying 10 feet - so if you hold on, it isn't moving.
Alternatively, if you're being grappled by a large ogre and it is hit and sent flying 10 feet by that same 10 foot push, there is a good chance you'll still be held by the ogre and go with it. I'd likely just have another grapple check to determine if you break free.
For levitate, the spell doesn't describe violent movement, and it has a weight limit. The description of the movement is brief, but I picture it as something rising up to 20 feet over a few seconds - so moving at a walking speed. That is not likely to break the grapple by itself due to a violent jerk - but if the two parties together exceed 500 lbs then all there is would be upward pressure on the target of the spell - they would not go anywhere. I might give the grappler disadvantage on grapple checks going forward as the spell is attempting to assist with breaking the grapple, but I'd factor in that the spell can apply 500 lbs of upward pressure, but the weight of the target offsets some of that, meaning that a grappler trying to hold a levitating creature needs to be able to carry 500 lbs minus the weight of the target.
So - when do I have the "removes the grappled creature" impact the grappled condition? When the grappler let's go (voluntarily or unvoluntarily), teleportation, etc...