The word persecution literally means to pursue. However, it includes malicious intent. It can vary in severity from just speaking nasty words to inflicting brutal violence. Jesus said to be happy about it because "great is your reward in heaven." Most of the prophets were treated harshly, because they confronted God's people with truth and reproved their godless behavior and their hard-hearted unbelief.
David was persecuted by King Saul, among others. The motivation was jealousy and envy. Saul was tormented by an evil spirit. David knew it was a spiritual conflict and refused to "stretch out [his]hand against the Lord's anointed." He said in Psalm 69:4: "Those who hate me without a cause are more than the hairs of my head; They are mighty who would destroy me, being my enemies wrongfully.".
Christians are reminded in Ephesians 6:12 that the cause of opposition and persecution is wicked spirits. David looked to God to protect and rescue him. "My times are in Your hand; deliver me from the hand of my enemies, and from those who persecute me." (Psalm 31:15) Jeremiah continually prophesied to God's people in Judah, even though they hated him and everything he said. His life was threatened on many occasions, and at one point, he was lowered into a pit up to his neck in mire. Some translations say mud, though some scholars say it may have been dung. Jeremiah relinquished his persecutors into the hands of God. "Let them be ashamed who persecute me, but do not let me be put to shame; let them be dismayed, but do not let me be dismayed. Bring on them the day of doom, and destroy them with double destruction!" (Jeremiah 17:18) When Jeremiah was lifted out of the pit, he continued speaking the word of the Lord.
It takes courage and commitment to continue walking and speaking for God even when persecuted. Jesus taught "But I say to you, love your enemies, bless those who curse you, do good to those who hate you, and pray for those who spitefully use you and persecute you." (Matthew 5:44) He was even hated and harassed for doing Godly things on the wrong day. "For this reason the Jews persecuted Jesus, and sought to kill Him, because He had done these things on the Sabbath." (John 5:16) Jesus said to pray for them. That may be asking a lot, but Jesus spoke the truth knowing that prayer can accomplish miraculous things.
In spite of opposition, the first century church grew in Jerusalem, until one day, Satan sent in his big guns. Saul has letters of permission from the chief to seek out Christians, have then arrested and imprisoned, even executed. Acts chapter eight records this. "At that time a great persecution arose against the church which was at Jerusalem; and they [the believers] were all scattered throughout the regions of Judea and Samaria, except the apostles." The believers went to other cities and just kept preaching God's Word, and no doubt, praying for God to solve the persecution problem. He did, and Saul (Paul) was transformed on the road to Damascus, and became the greatest apostle that ever lived.
As a Christian, Paul would later be persecuted himself. But like Jesus, he taught, "Bless those who persecute you; bless and do not curse." (Romans 12:14) Paul also taught Christians that nothing will ever separate them from the love of Jesus Christ, not "tribulation, or distress, or persecution, or famine, or nakedness, or peril, or sword." (Romans 8:35) He taught believers to endure. Even when wronged, he said, God will never forsake them but is faithful to rescue them out of all persecutions. He told Timothy that even though "All who desire to live godly in Christ Jesus will suffer persecution," he should "continue in the things which you have learned and been assured of, knowing from whom you have learned them." (2 Timothy 3:12, 14)
Like Jesus said, those who stand and speak for God are in good company, "for so they persecuted the prophets who were before you. Rejoice and be exceedingly glad, for great is your reward in heaven."