Actually none of these are examples of singing in a higher octave, they are examples of “modulation”, a changing of key, usually to a key that is a semitone to a few semitones higher than the original. It gives the feeling of a lift in the music because the singers are now singing at a slightly higher pitch than they were before. However it is far less than an octave higher.
Livin’ on a Prayer modulates from G to Bb, 3 semitones.
That’s the way it is modulates from E to A, 5 semitones.
Invisible Touch modulates from F to G, 2 semitones.
I Wanna Dance With Somebody modulates from Gb to Ab, 2 semitones.
A modulation at the end of song is an artist’s and/or arrangers choice to make. It is not done all the time but it does occur with some regularity. One to two semitone modulations are most common but as you can see by the examples sometimes bigger ones occur. Stevie Wonder in particular is an artist that has made use of modulation many times on his recordings over the years. “You are the Sunshine of my Life” and “My Cherie Amor” are two examples of a semitone modulation in his music.