Is there a rule, which states that one must or must not use comma before "then" in a sentence like this:
If you can read this, then you might want to answer this question.
Use comma in that sentence.
This is the general recommendation for sentences with a dependent clause followed by an independent clause. In your sentence:
From the Wikipedia page on Commas:
Note that it doesn't mean that it is wrong to not use comma in this case. As noted by the same page:
The answer, that you should use a comma in this sentence, comes from the use of "if." In fact, with the use of "if" you don't even need "then."
The comma here is required, and correct, because of the dependent clause "If you can read this." The word "then" is an adverb that just happens to appear after the comma that was triggered by the use of "If."
Now, if you did not have a dependent clause triggering the need for a comma, you would not insert a comma before "then." For example:
This is why many people almost instinctively add "and" before "then" to allow the use of a comma between two independent clauses. For example:
I didn't find some official rule, but, from this thread, if you are:
, then you need a comma.
Basically, apart from "then" as "an indication of time", a comma should be used in front of it.
Other usages are mentioned in this thread: