What is the Biblical basis for the doctrine of the Trinity? The word/term "trinity" is never used in the Bible. However, most Christians believe that God exists as three persons in one God-head.

This question has two parts:


What is the Biblical basis for the doctrine of the Trinity?
Are there any passages that directly show all three persons of God together - and what are they?
While the word Trinity does not occur in scripture, the concept and idea of the Trinity does, if you have eyes to see and ears to hear.  A detailed treatment of the Trinity with linked references can be found on GodAndScience.org.
In the following scriptural quotes, all bold text is my emphasis (in fact, there is no use of italics or bold in scripture), and note I tend to link to the whole chapter so it's easy to see the verses in context).
Fair warning: This going to be long, and even so it is only scratching the surface of an understanding that typically seems to take decades for most Christians to grow into in their understanding of God.  The TL;DR answer begins with the heading for &quot;God is Trinity&quot;
God Is Plural
Let's examine the scriptures to speak to God's plurality, and then see if we can understand the way that one God can also be three.
The first hint you can see is in Genesis 1, at the end of Day 6 when God creates man:

Gen 1:26-27
26 Then God said, “Let us make mankind in our image, in
our likeness, so that they may rule over the fish in the sea
and the birds in the sky, over the livestock and all the wild animals,
and over all the creatures that move along the ground.”
27 So God created mankind in his own image,     in the image
of God he created them; male and female he created them.

From this passage we could deduce that in some way, God is in some manner plural.  (We can also see that the image of God is both male and female, even though scripture consistently refers to the Godhead in the male gender).
Actually, though it's not obvious from the English, the first indication of plurality in God is in the very first verse in the Hebrew word for God:

The Hebrew word translated &quot;God&quot; is the word El or Elohim. Elohim is
the plural form of El. The plural form is used 2607 of the 2845 times
the word &quot;God&quot; is used in the Old Testament. Not only is the word for
God usually used in the plural form, but several verses refer to God
as &quot;Us&quot;
An example of how the Hebrew word Elohim is used in the plural is that
it is translated &quot;gods&quot; (referring to idols) 235 times in the Old
Testament. It is exactly the same word that is translated &quot;God,&quot;
referring to the Almighty. An example is given below:
&quot;I am the LORD your God [Elohim], who brought you out of the land of
Egypt, out of the house of slavery. &quot;You shall have no other gods
[Elohim] before Me. (Exodus 20:2-3)
Rich Deem (God and Science.org)

The Son is God
There are a huge number of verses in scripture that ascribe the same divine attributes to both the Father and the Son.  But to me, more &quot;obvious&quot; are the scriptures which state Jesus is God, outright.

Mat 1:23
22 All this took place to fulfill what the Lord had said through the prophet: 23 “The virgin will conceive and give birth to a son, and they will call him Immanuel” (which means “God with us”).

John 1 speaks not only to Jesus (the Word) being God, but that all that was created was created through him (Jesus).

John 1
1 In the beginning was the Word, and the Word was with God, and the Word was God. 2 He was with God in the beginning. 3 Through him all things were made; without him nothing was made that has been made. 4 In him was life, and that life was the light of all mankind. 5 The light shines in the darkness, and the darkness has not overcome it.
...
14 The Word became flesh and made his dwelling among us. We have seen his glory, the glory of the one and only Son, who came from the Father, full of grace and truth.
15 (John testified concerning him. He cried out, saying, “This is the one I spoke about when I said, ‘He who comes after me has surpassed me because he was before me.’”) 16 Out of his fullness we have all received grace in place of grace already given. 17 For the law was given through Moses; grace and truth came through Jesus Christ. 18 No one has ever seen God, but the one and only Son, who is himself God and is in closest relationship with the Father, has made him known.

And the letter to the Colossians gives us to know that Jesus is fully God, speaking of the risen Lord (notice the present tense):

Col 2:9
9 For in Christ all the fullness of the Deity lives in bodily form

Many more scriptures that speak to the deity of Jesus can be found here.
The Holy Spirit is God
Jesus speaks of the Holy Spirit as a person, on equal footing with himself and his Father:

John 14:25-27
25 “All this I have spoken while still with you. 26 But the Advocate, the Holy Spirit, whom the Father will send in my name, will teach you all things and will remind you of everything I have said to you. 27 Peace I leave with you; my peace I give you. I do not give to you as the world gives. Do not let your hearts be troubled and do not be afraid.

(by the way, in case you have ever wondered, this &quot;remind[ing] you of everything I have said to you&quot; is how the disciples recalled and recorded the Gospels so accurately and in such detail; it was through the Holy Spirit.)
And again, in the following chapters:

John 15:26
26 “When the Advocate comes, whom I will send to you from the Father—the Spirit of truth who goes out from the Father—he will testify about me. 27 And you also must testify, for you have been with me from the beginning.
John 16:12-15
12 “I have much more to say to you, more than you can now bear. 13 But when he, the Spirit of truth, comes, he will guide you into all the truth. He will not speak on his own; he will speak only what he hears, and he will tell you what is yet to come. 14 He will glorify me because it is from me that he will receive what he will make known to you. 15 All that belongs to the Father is mine. That is why I said the Spirit will receive from me what he will make known to you.”

For a fuller treatment of the Holy Spirit's deity and person, see here.
God Is One
So, having now seen that there are three persons in this God we serve, why do Christians then claim that there is but one God?  Again, it's because this is what God has revealed in the scriptures:

Deut 6:4-5
4 Hear, O Israel: The LORD our God, the LORD is one. 5 Love the LORD your God with all your heart and with all your soul and with all your strength.

This verse from Deuteronomy is especially interesting because the same plural-form word for God is used: Yahweh Elohim, followed immediately by the declaration that he is one.
In the New Testament, we read:

1 Cor 8:4
4 So then, about eating food sacrificed to idols: We know that “An idol is nothing at all in the world” and that “There is no God but one.

Again, more references can be found here.
But God is Trinity
Although the word &quot;trinity&quot; is not used, scripture does seem to teach three distinct persons who are identified as God, such as:

18 And Jesus came and said to them, “All authority in heaven and on earth has been given to me. 19 Go therefore and make disciples of all nations, baptizing them in the name of the Father and of the Son and of the Holy Spirit, 20 teaching them to observe all that I have commanded you.
Mat 28:18-20

So, scripture teaches us that God is both one, and at the same time three.  How can this be?  First you must accept that finite man cannot fully comprehend the nature and being of an infinite God.  The Trinity is a mystery - we can wrestle with it, we can approach it, we can apprehend it in our hearts, but ultimately our mind ends up only loosely understanding, like trying to wrap your mind around the concept of infinity.
Of particular concern is trying to explain God by use of analogy, these always break down, and I have never heard one to even remotely adequate to fully picture of the Trinity as alluded to in scripture (they give us a glimpse, but taken alone the picture is nearly always of a heretical understanding).
I have struggled with the idea of the Trinity all my journey, but recently I read Frank Sheed's Theology and Sanity, which I found very helpful.  He does not attempt to explain by analogy, but describes God as being one nature shared by three persons.  I will end with some quotes from his book (emphasis Sheed's):

The notion is unfortunately widespread that the mystery of the Blessed Trinity is a mystery of mathematics, that is to say, of how one can equal three.  The plain Christian accepts the doctrine of the Trinity; the &quot;advanced&quot; Christian rejects it; but too often what is being accepted by one and rejected by the other is that one equals three.
...
The short statement of the doctrine is, as we have heard it all our lives, that there are three persons in one nature. But if we attach no meaning to the word person, and no meaning to the word nature, then both the nouns have dropped out of our definition, and we are left of with the numbers three and one, and get by as best we can with these.
...
The doctrine may be set out in four statements:

In the one divine nature, there are three persons - the Father, the Son and the Holy Spirit.

The Father is not the Son, the Son is not the Holy Spirit, the Holy Spirit is not the Father: no one of the persons is the either of the others.

The Father is God, the Son is God and the Holy Spirit is God.

There are not three Gods, but one God.


...
We are not saying three persons in one person, or three natures in one nature; we are saying three persons in one nature.  There is not even the appearance of an arithmetical problem.  It is for us to see what person is and what nature is, and the to consider what meaning there can be in a nature totally possessed by three distinct persons.
...
Nature answers the question what we are; person answers the question who we are.