The Holy Spirit as Comforter is a major topic of John 14-16. In 14:16 and 16:7 the Holy Spirit is described as παράκλητος, paracletos, a noun which is translated Comforter (KJV, NIV 1984), Helper (ESV, NASB), Advocate (NIV 2011), Counselor (HCSB), or sometimes it is left untranslated, Paraclete. A real problem for understanding the word is that the English words have a different connotation than the Greek. (D. A. Carson quips that the translation “comforter” sounds more like a quilt, although “counselor” is good, as long as one does not think of a marriage counselor or camp counselor!)
In pre-Christian Greek, the noun can have the sense of a advocate or mediator in a general way. Someone who is called upon to give assistance in a time of need could be described as a paraclete. This word rarely means “lawyer” in the modern sense of the world. The word was often translated into Latin by the word patronus, a patron who comes to the aid of a client. The patronus was a sponsor or advocate of the client, and could in some respects shield the client from legal trouble, or provide representation for a client in a court case. (This is a fascinating possibility, given the discussion here on the status of friendship in the ancient word.)
This may be the sense of the word in 16:7, since the Spirit is described as convicting the world of sin and guilt. But the Spirit is not an advocate for the defense of the disciples, but rather a prosecutor of the world. The legal metaphor is found in 1 John 2:1, where Jesus himself is called our advocate before the Father.
Perhaps the background for this word should be the Hebrew Bible rather than Greek usage. The form of the word which appears in John does not appear in the LXX, but the related form παράκλησις does 16x. Most often the word has the sense of consoling a person who is grieving, the exception is Isa 28:29, God is “wonderful in his counsel” (advice, plans, etc).
In Isaiah 57:18 and Hos 11:8, the Hebrew word is נְחֻמִים, a noun built on the root נחם, one of the most theological important words in the Hebrew Bible. The verb appears at the beginning of the second part of Isaiah, the “voice crying in the wilderness” announces “comfort” for God’s people at the end fo the exile. God is beginning to make a straight and level path from Babylon back to Zion so that his people may return in a new Exodus.
The role of the Spirit in Isaiah 40-55 is to announce the coming of the new age when Israel’s long exile is finally over. The ending of that period of estrangement between God and his people Israel is an occasion for compassion – God has compassion on his people and he draws them back to himself.
If this background from the Hebrew Bible is what Jesus had in mind when he described the Holy Spirit as the “comforter” who is coming, then he is alluding to the common tradition of the Hebrew Bible that the coming eschatological age will be a time when the Holy Spirit is poured out on God’s people.