In John 15, Jesus tells us that the world will hate believers. Friends of the Lord are not friends of the world.
John 16:1 says, "I [Jesus] have said all these things to you to keep you from falling away."
The phrase falling away doesn't mean someone can lose their salvation. R. V. G. Tasker points out that this phrase in Greek refers to being caught in a trap or being taken by surprise.  So, Jesus was going to send out His disciples into a selfish, self-centered, pleasure-oriented world with the call to repent. They were to tell listeners that they would be judged for their sin but that God had provided a way of escape, faith in His Son. Still, the world would respond with hostility.
This should have come as no surprise. When Noah built the ark, he was mocked. When Lot declared that Sodom and Gomorrah would be destroyed, he was mocked. When the prophets spoke out against sinfulness, they were mocked. The same would be true of the disciples.
Why? Because the world loved sin and was blinded by it. The same is true to this day. Of course, this is to be expected. But aren't we safe in our religious communities?
Verse 2 of John 16 says, "They will put you out of the synagogues. Indeed, the hour is coming when whoever kills you will think he is offering service to God."
Before Saul of Tarsus encountered Jesus on the road to Damascus, he was being a faithful Jew by imprisoning and killing Christians. He believed he was honoring and serving God and His people. After Jesus saved Paul, the Jews, who once loved and praised him, persecuted him (2 Thessalonians 2:14-16).
How is it people who claim to be loving, full of grace and mercy, who desire to promote unity and reconciliation, persecute faithful Christians?
In John 16:3, Jesus says, "And they will do these things because they have not known the Father, nor me."
How are believers to endure persecution?
Verse 4 says, "But I have said these things to you, that when their hour comes you may remember that I told them to you. I did not say these things to you from the beginning, because I was with you."
When we experience hostility and persecution, we're to stand on the Word of God despite the fierceness of the persecution. And we can rest assured that we're not alone.
In 2 Timothy 4:17, Paul wrote to Timothy, saying, "But the Lord stood by me and strengthened me, so that through me the message might be fully proclaimed and all the Gentiles might hear it. So I was rescued from the lion's mouth".
The Lord stands with us when we're going through persecution. He encourages us. He comforts us. He gives us the words to say. So, we must continue to stand, proclaiming the gospel even when the world is hostile.
But how are we able to share the gospel when it could cost us resources, friendships, and even our lives?
Jesus tells us in John 16:5-6, "But now I am going to him who sent me, and none of you asks me, 'Where are you going?' But because I have said these things to you, sorrow has filled your heart."
Jesus doesn't mean they'd never asked Him where He was going. We know that they had. However, they were focused on their grief and despair—and on their misunderstanding of how the Master would establish His kingdom. They couldn't see the big picture. They didn't understand that Jesus had to return to the Father, so that He would send the Holy Spirit to empower them to fulfill the great commission.
In order for us to be effective witnesses, proclaiming the gospel in the midst of trials, hardships, and persecution, we must focus not on ourselves but on the Lord. Even if the persecution costs us all we have, His glory should be our aim. If we keep our focus on Christ, He will give us the strength to endure.
In verse 7, Jesus says, "Nevertheless, I tell you the truth: it is to your advantage that I go away, for if I do not go away, the Helper will not come to you. But if I go, I will send him to you."
We have His Word. We have His Holy Spirit. We have all we need to get to know Jesus—and to make Him known even in the face of persecution.
 R. V. G. Tasker, Commentary on John, p. 181