I think that Nigel is correct in that we can’t be 100% sure but I believe there are enough contextual clues that would give us a good indication that Paul was speaking of his death. All verses KJV.
In verse 2 Timothy 4:1, Paul mentions that Christ will judge both the living and the dead at His appearing and kingdom.
I charge thee therefore before God, and the Lord Jesus Christ, who shall judge the quick and the dead at his appearing and his kingdom;
In the verses to follow, Timothy can be seen as the one “living” and Paul the one who is “dead” (or soon to be dead). Notice Paul gives Timothy instructions which would bode well for Timothy at the Judgment Seat of Christ.
2 Preach the word; be instant in season, out of season; reprove, rebuke, exhort with all long suffering and doctrine.
3 For the time will come when they will not endure sound doctrine; but after their own lusts shall they heap to themselves teachers, having itching ears;
4 And they shall turn away their ears from the truth, and shall be turned unto fables.
5 But watch thou in all things, endure afflictions, do the work of an evangelist, make full proof of thy ministry.
Paul then, in verse 6, speaks clearly about his upcoming death. Notice the language he uses. He says that he is “ready to be offered”. I believe this is a clear metaphoric reference to an animal sacrifice used under the Old Covenant, as if he has now been prepared for sacrifice and he is now jus waiting for the actual sacrifice to take place. So, the reference to “my departure is at hand” is directly connected to his being prepared to be offered as a type of sacrifice.
6 For I am now ready to be offered, and the time of my departure is at hand.
7 I have fought a good fight, I have finished my course, I have kept the faith:
In verse 8, Paul states that Jesus will give him a crown of righteousness “at that day”; a reference to the judgment seat of Christ when Christ returns. Please note that just because Paul mentions receiving a crown from Jesus and also references that same crown will be given to all those who believe at His return, does not mean that the timing of each action is the same, ie there could be a gap between the time when Paul dies and his receiving his crown.
8 Henceforth there is laid up for me a crown of righteousness, which the Lord, the righteous judge, shall give me at that day: and not to me only, but unto all them also that love his appearing.
In verse 18, Paul then states that God will “preserve me unto his heavenly kingdom”.
18 And the Lord shall deliver me from every evil work, and will preserve me unto his heavenly kingdom: to whom be glory for ever and ever. Amen.
I am no Hebrew scholar but my lexicon states:
τινα εἰς τήν βασιλείαν τοῦ κυρίου αἰώνιον, to save and transport into etc. 2 Timothy 4:18
Per my lexicon, the word has many usages where the action is in the future. So, I would read this to mean that there is a defined gap between Paul’s death and the transport into the Kingdom of God. Paul’s usage of the word “preserve” I believe is purposeful and is a reference to the Old Testament belief that God is the one who “preserves the soul”. EG: Psalm 97
10 Ye that love the Lord, hate evil: he preserveth the souls of his saints; he delivereth them out of the hand of the wicked.
Please also note the language is similar here to verse 17 of 2 Timothy 4 where Paul states that God delivered him out of the mouth of the lion. This is a clear reference to the actions of evil against Paul.
17 Notwithstanding the Lord stood with me, and strengthened me; that by me the preaching might be fully known, and that all the Gentiles might hear: and I was delivered out of the mouth of the lion.
Finally, Paul uses references the power of God to preserve the soul earlier in the Book of 2 Timothy.
2 Timothy 1:12
For the which cause I also suffer these things: nevertheless I am not ashamed: for I know whom I have believed, and am persuaded that he is able to keep that which I have committed unto him against that day.