(I'm not a mathematician, so I have to assume that it refers to the algebra.)
The consequence clause (apodosis, then clause) is the main clause in the sentence and must have an explicit subject. Then is not required at the beginning of this clause.
If the algebra is not nilsemisimple, it necessarily contains ...
However, then can be helpful in making your argument clear if the condition clause (protasis, if clause) is very long or complex
If the algebra is not nilsemisimple (and we have already established that in the case at hand the algebra in fact is not nilsemisimple), then it necessarily contains ...
Note that a pronoun may precede its referent if it falls in a clause subordinate to the clause containing its referent. In a conditional construction the condition clause is subordinate:
If it is not nilsemisimple the algebra necessarily contains ...
And if the subject of the condition clause is the same as the subject of the consequence clause AND the condition clause is headed by a form of BE, the subject and BE may be omitted:
If not nilsemisimple, the algebra necessarily contains ...
You can also reorganize the sentence, which sometimes makes the referents and the structure of your argument clearer:
The algebra, if not nilsemisimple, necessarily contains a non-zero nilpotent matrix N ...
And in many cases you can replace this kind of condition clause with a restrictive relative, or even an attributive adjectival:
An algebra which is not nilsemisimple necessarily contains ...
A non-nilsemisimple algebra necessarily contains ...