The radar only runs out if you run outside of the grassy patch you activated it in (even if you run to a different grassy patch in the same area), Run from a pokemon you encounter, encounter a pokemon by means other than the Radar, or encounter a pokemon different from the one you encountered right after activating the Radar.
You can take a step or two away from the grass and it won't "run out" but if you venture too far from it, you'll notice the music will go back to whatever the music is for that route.