Jesus has finished listing off the reasons why he is praying for the disciples, and he now turns his attention to specific requests for them. He prays for that they will be set apart for the sake of the world.
Jesus’ earthly work is coming to a close, but the work of the disciples has just begun. In order for them to be successful in this work, they must continue to remain in Jesus by remaining in his word. Yet, to the extent that they do so, the rebellious world will surely hate them. They may be tempted to reject Jesus, or make compromises with the world, or to withdraw from the world altogether, but taking any of these options would be sin. If they did any of these things, they would cease to be the witnesses that they need to be.
Jesus prays that the disciples would be set apart for God’s service. Specifically, he is setting them apart as witnesses to a lost world, though this calling will involve unpleasant consequences. Just as he is set apart for pain and suffering, so they shall be also.