It breaks the restrainment
Of course, your GM has the last word on this. But if you are a GM looking for guidance, I'd strongly suggest to rule that the restrained condition (which was caused by a spell like Entangle, Maximilian’s Earthen Grasp, Evard’s Black Tentacles or Web) ends if the target somehow leaves the area that caused restrainment, may it be through forced movement or by teleporting, and here's why:
It counters the restrainment
In Appendix A: Conditions of the PHB we read (emphasis mine):
A condition lasts either until it is countered (the prone condition is countered by standing up, for example) or for a duration specified by the effect that imposed the condition.
Of course, it remains vague what might "counter" a restrainment, so it's still up to the GM to decide, but this gives the GM the RAW-part to justify their ruling. Moreover, the example shows that a counter to a condition isn't necessarily a spell like lesser restoration - it can be as simple as standing up.
It's realistic if restrainment was caused by an external effect
Almost all spells that apply the restrained condition use some form of external effect (entangling vines, a medium sized hand, tentacles, the magical trap from Snare, a Watery Sphere, etc.) that has the potential to hold a target in place. But if the target leaves the affected area/volume (maybe by teleporting far away but without the effect following along), it's unplausible that the restrainment remains. After all, "because: magic" is a very unsatisfying answer in a quite realistic and immersive game like D&D.
In contrast, the spell Flesh to Stone specifies that the target becomes
restrained as its flesh begins to harden
so in this exceptional case, teleportation or forced movement wouldn't realistically end the restrainment as it is due to an interior effect. Note that interior effects usually apply conditions like stunned, paralyzed or incapacitated instead of restrained.
It was treated this way in previous editions
In 4e, teleporting away from a effect located in a specific space would end the restrainment. Of course, that does not imply anything about 5e, but it hints at what is a reasonable ruling.
Don't rely on inversion
Some answers hinting that the restrained condition remains argue that spells do what they say they do. While this is true, it does not mean that spells don't do what they don't say (as this would be the non-equivalent inversion of the previous statement). In other words: spells still might work in a way that the spell's description does not specify: In this game of infinite possibilities, these descriptions cannot consider every circumstance.
Even if some spells (like Web) explicitly describe that leaving its area ends restrainment, the same may apply to spells like Entangle that do not explicitly state this behaviour. As an analogy, Misty Step (of course) teleports your worn equipment with you even though the spell text does not state this explicitly - such a specification would be "needlessly fastidious".
Does the removal itself succeed?
Above, we argued why removing a creature from an external restrainment effect would end the restrained condition on it. However, it may be difficult for the removing effect to work in the first place:
- the casting of a teleportation spell might be hindered by vines wraping around the creature's jaw or hands,
- Maximilian's grasping hand might be able to hold its target in place and negate forced movement,
- Evard's Tentacles might be stronger than the ally trying to pull you out of their reach.
To resolve these questions, by the GM's discretion, an appropriate ability check could be deployed to see if this way of countering the restrained condition succeeds.