> A flat or sharp can be the tonic, which does not lead to any other note.
You're right, and this is most often seen with flats; when Bb is the tonic, it doesn't "want" to resolve to A. --Of course, a modulation to F - the next-sharpest key in the cycle of fifths - is enough to change that. A "stable" sharp note is seen starting from the key of D, where F# is a stable third. But in the context of enharmonic notes, what I said generally holds. F# and Gb, to take the most common example, are so far in the 'extended' cycle of fifths that whenever both appear in the same piece, one can generally assume that the rule holds.
> A note is named flat or sharp to maintain proper interval distance without repeating letters within the scale.
Notes are not just named flats or sharps; at least in principle, there can be double, triple etc. sharps, and double, triple etc. flats. This is done in order to properly notate modulations in the cycle of fifths; one does not arbitrarily "switch" from sharps to flats, but just keeps adding to them.