In The Riddles of the Fourth Gospel, Paul N. Anderson says there were three periods during which the Gospel of John developed within a specific community:
The Palestinian Period-30 to 70 CE
The First Asia Minor Period–The Johannine Community-70-85 CE
The Second Asia Minor Period–Johannine (and other) Communities-85-100 CE
What was happening with the community that eventually produced the Gospel of John in each of these periods?
During the Palestinian period there was a dialogue with Jerusalem Jewish authorities (who in the Gospel are called “the Jews” or “the Judeans”). These persecuted and killed Jesus. But for many years after that they opposed the followers of Jesus who were mostly from north Israel and demeaned them as “Galileans” (John 7:52) and Samaritans (John 8:48). One of the reasons the Judeans claimed Jesus could not be the Messiah was that he was from Nazareth and not Bethlehem (John 7:41-42).
Also during this period there was a dialogue with the followers of John the Baptist as the community drew in more of John’s followers by emphasizing the signs of Jesus (John 10:42). After the Jewish War, the community moved to Asia Minor.
During the first Asia Minor period there developed a dialogue with Hellenistic synagogues. Against the theory of J. Louis Martyn, Anderson does not think that the synagogues usually excluded Christians. However, Martyn had a point in that as John’s community tended toward the worship of Jesus as the divine Word, tensions between the synagogues and the Christians in them would have increased. Passages in John about Christ-followers being “put out of the synagogue” may project this tension back into the ministry of Jesus. Some Christians withdrew from the synagogues. At some point a group of these decided to reaffirm Judaism and rejoin the synagogue. This is what 1 John 2:18-23 is about.
Also during this period the Roman state began to seriously promote emperor worship. This put pressure on the church
By the second Asia Minor period the Johannine community has developed worshiping communities separate from or parallel to the synagogue.
There arose a conflict between church leaders who wanted no compromise with the cult of Caesar and those who wanted to avoid being persecuted for not making sacrifices to the emperor. The compromisers took advantage of the high christology developing in the John community to downplay the humanity of Jesus. On the cross he, being divinely above it all, had not really suffered. So Christians were not obliged to suffer either. These were the people condemned in the letters of John for believing that Christ had not “come in the flesh”.
The new material of this period included the Logos hymn of John 1 that began to be recited or sung in the worshiping communities and the confession of Thomas that Jesus was “Lord and God”, a direct rebuke of the cult that claimed these titles for Caesar.
The letter of 3 John belongs to this period. It attacks the bishop, Diotrephes, as part of an encounter between the community and the institutionalizing tendency of the larger church.
In this period there culminated something that spanned all three periods. That was the development of the Johannine tradition as a counterpoint to the Synoptic traditions. Anderson considers that John knew the other gospels and felt a need to correct the record on some points and to lift up another way of conceiving of Jesus.
He actually speaks more of a Bioptic tradition than a Synoptic tradition, because Matthew and Luke follow Mark in chronology. Many of the historical difference are not really 3 against 1, but 1 against 1. In other words, Anderson does not think that a threefold witness overwhelms John’s witness. There is really only a twofold witness.
To critique this in a small way, what Anderson says is true of chronology but not the sayings material. Thus we should not discount the witness of John that Jesus went to Jerusalem for several festivals over a few years on the grounds that there are three witnesses against it. There is really only one. On the other hand, there are several sources for the sayings of Jesus. The vast difference between the parables and saying in the Synoptics and the discourses in John really is a situation of three or more against one.
The exception to that is one saying from the so-called Q material. Matthew 11:25-27 and Luke 10:21-22 give us language from Jesus that matches the discourse sayings in John.
I do not know what the relation of John’s discourse material is to the historical Jesus. A lot of people would say that it is all from John who expands on simple sayings of Jesus or just puts these words in Jesus’ mouth.
There is a fascinating speculation by Stevan L. Davies in Jesus the Healer that the historical Jesus sometimes spoke ecstatically in an altered state of consciousness as the Son of Man and that, when speaking in this state, he used the style of the Johannine discourses.