Having muddled through for a few years, I'm finally learning the basics of harmony. I'm having a bit of trouble, though understanding exactly what goes on when chords occur from outside the key. Is the key changing? Or are these 'borrowed' chords, and in which case, how are they decided on?

For example, see the classic "I Can't Forget" by Leonard Cohen.


            
                
                    
                    
                    
                    
                    
                
            

Here is an apparently accurate transcription of the chords in the verse:

http://www.maartenmassa.be/CohenChords/09iym/i_cant_forget.htm

    F#
I stumbled out of bed
       D#m
I got ready for the struggle
F#
I smoked a cigarette
     D#m               C#
And I tightened up my gut
   B         Bm       G#m
I said this can't be me
 A#          E    D#m
Must be my double
F#              B    
And I can't forget... (etc)


OK, so I see I-vi-I-vi-V of F# major, taking us to the line "I said this can't be me". This makes sense to me. But what happens then? 

It seems to modulate to B minor - fine, I think we're heading for a scale with B minor in it, ie A major, D major(/B minor),  or G major. But this is followed immediately by G#m, though, so it's not any of those (maybe we're back in F#?), but then we get A#!? E? 

I am totally confused at this point as to what key we're in.

It's particularly galling as the change to A# is my favourite chord change in the song, and the whole run from B to D#m, and then back to F#, is weirdly satisfying.

Can anyone explain what's going on here?


Question: A functional inequality
Answer: $\let\eps\varepsilon$It is easier to consider a function $f(x)=-\log g(e^{-x})$. Then $f\colon (0,\infty)\to(0,\infty)$ is still continuously differentiable and increasing (the bordering conditions are almost not in the game), and it satisfies 
$$
  f((t+1)x)&lt;f(tx)+f(x)  \qquad (*)
$$ for all $x\in(0,+\infty)$ and positive integer $t$ (I do not know why you set $t&gt;1$...).

Now let us consruct such an $f$ violating the desired condition. Firstly, we set $f(x)=x+\eps$ for a small $\eps&gt;0$, so that it satisfies $(*)$. Next, we perturb $f$ in a small neighborhood of $x=5$ so that now $f(5)$ is slighly greater than $f(2)+f(3)$, thus violating the desired condition. Surely, now it also violates $(*)$, but this happens only for $x$ being in a small neighborhood of $5/2$, or for $x$ being almost in $(0,5/3)$ (or, recursively from $5/2$, for $x$ around $5/4$ and smaller ones). Thus, now it is easy to perturb $f$ in a neighborhood of $5/2$, and then simply to increase it on, say, $(0,\,1.9)$ so that it becomes, say, $1.1x+\eps$ on $(0,\,1.7)$. The details can be simply recovered.