Paul is urging Timothy to endure for the cause of Christ. He gives Timothy the example of the soldier, who works hard to please his master and the farmer, who works for the reward of the harvest, etc. He then quotes a hymn in verses 11-12 that evidently is doctrinally correct to give Timothy further motivation for enduring. What then is the motivation? We must take the structure into account to determine this.
The second thing to consider is the literary structure of the quote. It is quite common in Hebrew literature to see things arranged around a chiasm. It is possibly the case in this passage. And thus we have the following:
a. For if we died with Him, we shall also live with Him.
b. If we endure, we shall also reign with Him;
b.1 If we deny Him, He also will deny us;
a.1 If we are faithless, He remains faithful; for He cannot deny Himself.