1) A real present/future condition assumes a real main action: If I see him, I will run away. As you see, the Present Indefinite is used in the subordinate (future tenses are not allowed in a conditional clause!) and the Future Indefinite in the main clause.
2) An unreal present/future condition is expressed using the Past Indefinite Tense (the verb 'to be' has the form 'were' in all persons): If I saw him...(If I were you...). The predicate of the main sentence has the form 'would/could + verb'.
Example:If I saw him now, I would run away. If I knew it before it started, I could do much better. 3) An unreal past condition is expressed using the Past Perfect Tense: If I had seen him... The predicate of the main sentence has the form 'would/could + have + Past Passive Participle of the verb'.
Example:If I had seen him then, I would have run away. If I had known it on that day, I could have done much better.
Exception:In some cases the use of tenses in the main and subordinate clause is independent of each other. For example, if a condition extends from past to present but the action is no longer possible, mixed rules can be applied: Past Indefinite in the subordinate and 'would/could + have + Past Passive Participle' in the main clause.
Example:If I knew it (generally), I could have done better (in the past). One last remark concerns the fact that both the condition and the main action can be expressed by means other than a clause, or even just implied. The rules for the use of tenses in the remaining part of a sentence still apply.
Example:At his appearance I would run away. Under other circumstances I could have done better. If only you had said that before!