The spell Summon Greater Demon is quite clear on where your summoned demon appears at.
The demon appears in an unoccupied space you can see within range...
The wording of this spell is very similar to the rest of the spells that summon things in regards to where the summoned creature materializes at. And the spell goes on to say how the demon can disappear: zero hit points, the PC loses concentration, etc.
What if you aren't using the spell in combat and you want it to fly to a neighboring city and kill someone? Are there rules for this that aren't mentioned in the spell description?
What happens when a summoned demon goes out of range?