I know the window was shut. (indicative mood)
Where the indicative mood tells, the imperative commands, and the subjunctive wishes or speculates:
Shut the window. (imperative mood)
I wish the window were shut. (subjunctive mood)
Mood indicates how the writer thinks about a subject. If you wish something were true or speculate about what might happen (subjunctive mood) or give a command (imperative mood), you let the reader know this by changing the form of the verb or by the omission of certain words.
Consider this embarrassing situation: A husband comes home unexpectedly and sees a man fleeing out his back door. He rushes into the bedroom and accuses his wife of cheating on him, and she responds:
So what if my lover were here? (subjunctive)
By using the subjunctive mood, she is not confessing; she’s inviting her husband to consider a hypothetical question.
But the situation is quite different if she says:
So what if my lover was here?
Now she is indeed confessing and wants to know what her husband intends to do about that fact.
The changing of was to were is the signal for the mood involved—the subjunctive mood.
Look at the subjunctive in another sentence:
The captain ordered that the sails be hoisted and the anchor be weighed.
You might expect the imperative since the captain is giving an order, but—since the desired condition of the sails and anchor are not yet fact—you use the subjunctive.
Once the order has been carried out, you could use the indicative mood to express the situation:
The captain saw that the sails were hoisted and the anchor was weighed.
Compare that to the imperative mood, used to give a command or to direct someone in the performance of a task. Note that the imperative mood is created by removing the implied subject, which in English is always you.
"(You) Hoist the sails! (You) Weigh anchor!" yelled the captain.
Now we are hearing the captain give the actual order—in contrast to the first sentence, where we are merely reporting what the order was. This distinction will become quite important when you start writing dialogue and quotes. It differentiates between the summarizing or paraphrasing of speech and the speech itself.
Your Book Editor