First, note that "x is y" is not always logically equivalent to "y is x". For example, "Fools are my friends" is different from "My friends are fools" (because the first allows wise men to be my friends too, whereas the second does not); "All men are mortals" is very different from "Mortals are all men" :-)
That said, sometimes there is an equivalence, and some ideas can be expressed either way. In these cases the verb will agree with whichever you choose to make the subject ("One side-effect is headaches"; "Headaches are one side-effect").
(Note that in your examples, "**Our goal were the mountains" is wrong - in standard writing it should always be "Our goal was (complement)". But you could say "The mountains were our goal", with the same basic meaning but different emphasis.)
Addressing your second question: wholesale inversion of a "to be" sentence (where a sentence of the form "noun copula complement" changes to "complement copula noun") is rare, except for in specific situations:
- Questions (because English likes the question word to go first: "Who is Fred? Fred is the tall man"). The inversion always happens unless there's a specific reason not to (perhaps expressing surprise - "He's whose brother?")
- Certain comparative expressions ("Better still are the ones that follow"). The inversion here is optional ("The ones that follow are better still" is fine too).
- Expressions describing location. The simplest in this category are "There is...", "Here are..." and friends, but I'd also include in this category "Next to my house are two restaurants", "Found in every city are cars and buses". This inversion is optional.
- Poetic effect - either for emphasis, or for reasons of metre/rhyme ("Blessed are the meek" - the natural phrasing is "The meek are blessed"; the inversion serves to imply a very great level of blessedness; "Old King Cole was a merry old soul, and a merry old soul was he" - the inversion is clearly unnecessary but nicely fills up the line)
Note that in these situations (except possibly the last), it is usually very clear from the construction that the word or phrase at the start of the sentence is not the subject - often because it's an adjective or adverb phrase. In situations where the distinction is not so clear - such as the examples you provided - inversion will rarely if ever be used (since the sentence tends to end up sounding plain wrong, rather than inverted).
Do note that there are a large number of situations where a slightly different form of inversion ("noun verb complement" changing to "verb noun complement") is used - where it is forced or allowed by the use of certain forms or expressions. Examples such as "Is he tall?", "Never am I angry" are examples of this second kind. I won't attempt to enumerate these, because for one thing there are a lot of them, and for another I don't think the uncertainty you're concerned with arises here. In any case, here is a list of uses of inversion, that contains both types.
[Edit to respond to edit in question]
I have to agree with Fowler about the time periods: the "six months" is considered a single unit, so the singular is used; this is common when referring to measured quantities:
- Ten pounds is a small amount to pay.
- Two litres is more than enough.
We can tell that this is not inversion by using a verb where the ambiguity doesn't arise:
- Six months seems like an eternity.
- Five dollars buys me a very nice lunch.
We can construe the sentence like Fowler as meaning "A period of ...", "An amount of ...", or equivalently by considering the phrase as meaning "Six months of time", "Five pounds of money"; mentioning the uncountable noun makes the reason for the singular clearer, and distinguishes this case from the "light of the stars" case, where there's no obvious way to do the same.
(The plural can sometimes also be used in these cases, giving a sense of referring to each of the individual items mentioned "The six months are dragging on slowly" emphasises that every single one of them is felt.)