A subordinate clause introduced by the word "wenn" usually describes a condition for an action or the consequence described by the independent clause. Such sentences are known as conditional sentences. Clauses that begin with "wenn" answer the question "Unter welcher Bedingung?" (under what condition?). You've already learned about factual conditional clauses with "wenn", which are used when the condition and resulting action are predictable. In those cases the present tense is used in both the independent clause and the subordinate clause. Sometimes the future tense is used in the independent clause.
Example:
Wenn du die Karte nicht abstempelst, dann ist sie nicht gültig.
(= Unter welcher Bedingung ist die Karte nicht gültig? - Wenn du sie nicht abstempelst.)
A hypothetical condition clause describes a condition that may or may not be possible but is not factual. It exists only in the mind of the speaker. It can refer to something in the past, present or future. These clauses are formed by using the subjunctive II or its alternative, "würde" + the infinitive.
In a counterfactual conditional complex sentence, the subjunctive II is usually used in both the main and subordinate clauses. The subordinate clause contains the condition and is introduced by the word "wenn". A comma separates it from the independent clause.
Examples:
Ich wäre glücklich, wenn du Deutsch lernen würdest!
Was würden Sie machen, wenn Sie das Geld hätten?
Wenn ich die 10 Millionen hätte, würde ich Bücher schreiben.