The Psalms of David are loved by Christians and Jews alike, because King David was a mighty warrior who won many battles for the nation of Israel in and around the 10th century BC. He was first an underground king, anointed by a Prophet who heard God's voice named Samuel--at this point in time, He was the King of Israel in God's eyes--but he was not revealed as King until much later because there was an evil king named Saul who reigned at the time he was anointed. But God was with David, and providentially protected him from harm, because it was always God's plan to establish a kingdom for David and to his future offspring. Christians believe this was fulfilled in Jesus Christ. Jews still await this fulfillment at some point in the future. The Psalms make up the largest portion of Scripture in the Bible, and is mostly songs that were written by David and sung by the nation of Israel throughout its ancient history.
As you can tell from these lyrics, there is a lot of reference to "enemies" and "war". In studying ancient times, we may think that people were more barbaric, which is true to a certain extent, but not in others. Although it may seem odd to sing a song to God asking for deliverance from political enemies, and rejoicing in an enemy's defeat... Christians have often interpreted these psalms as being fulfilled in Jesus Christ. Jesus defeated our true enemy, whom he calls "the evil one", and the forces of darkness which keep the world in a fallen state. If it's difficult for you to grasp that concept, you could think of these "enemies" as certain vices we struggle with, or thoughts which barrage our minds. As one man has said, "Anxiety is the devil". Disclaimer: Mental health struggles have not only a spiritual element, but also a physical one. If you struggle with mental health issues, you should consult your doctor.