I'm afraid my answer is the boring one: free variation, based on the amount of space available.
The tilde originally arose purely as an abbreviation: instead of writing an n or m in line with the text, it could be written above the vowel instead, saving a bit of space. Eventually its form got simplified into the tiny squiggle we use nowadays.
But the meaning was always simply an orthographic one: "there should be an n or m after this letter". It didn't necessarily indicate anything about the pronunciation, or about the grammar: it could be used in prefixes or roots just as well as suffixes. For example, the following shows ĩperpetuũ (i.e. imperpetuum), with two nasals removed in different places:
So in instances like this, the choice of whether to use a letter or a tilde comes down purely to how much space is available. On the second line, writing civium would have compressed the other words in an unpleasant way; on the third line, using both saltem and vitam would have led to too much compression, while both saltẽ and vitã would have left too much empty space. So saltem was written out in full, and vitã abbreviated.
If possible, such as when there's all the space in the world available, final letters are generally included: you can see that there are no abbreviations in the other verses, where there was more freedom to adjust the kerning and spacing (since it didn't have to line up with the notes). But in manuscript documents, where scribal effort and space are at a premium, abbreviations will often be used wherever the scribe can get away with them.
(P.S. The tilde's use eventually expanded to cover other removed letters, apart from n and m. But nasals were always one of the more popular uses for the symbol.)