1)
What is the connection of the end of the verse to the beginning?
1.
Rashi citing Targum Yonasan: When I call to him, I will thank him (Rashi Tehilim 18:4 - even before the salvation), for I trust that he will save me from my enemy.
2.
Rashi: I will thank him, for he saves me from my enemy.
3.
Radak: When I pray and I call to Hashem, and I praise him with my Tehilim, then I am saved from my enemies.
4.
Malbim (Tehilim 18:4): At a time like this that I am not afflicted at all, I call to Hashem and call Him 'praised', for all His good acts, and through this alone I am saved, and I need not pray [for salvation] at all.