Within some cultures it is common that certain quotations, secular or religious, are known and even memorized because of their importance. The Pledge of Allegiance, the Lord's Prayer, are good examples of quotations that if started can be completed by most people in our culture..
This was certainly true of the psalms in Jesus time. He needed only to say the first line, and most Jews would have known the rest, or at least the message.
Jesus was quoting Psalm 22, a messianic psalm that vividly describes the agony the suffering servant would endure. God the Father did not abandon his Son in his Son's suffering but allowed him in his humanity to experience the sense of divine abandonment that humans often feel during times of need, and especially when in sin. Similar to how we might feel that God has abandoned us when we are suffering (even though this isn't the case), so the Son of God in his humanity experienced that aspect of human suffering as well. He died for our sins, and the weight of those sinsand thus the feeling of abandonmentmust have been exceedingly heavy at that point.
Read all of Psalm 22. By quoting this psalm, Jesus shows that he is the fulfillment of that prophecy and that he will be vindicated, which is evident in the psalm's triumphant ending.
1 My God, my God, why have you forsaken me?
Why are you so far from helping me, from the words of my groaning?
2 O my God, I cry by day, but you do not answer;
and by night, but find no rest.
3 Yet you are holy,
enthroned on the praises of Israel.
4 In you our ancestors trusted;
they trusted, and you delivered them.
5 To you they cried, and were saved;
in you they trusted, and were not put to shame.
6 But I am a worm, and not human;
scorned by others, and despised by the people.
7 All who see me mock at me;
they make mouths at me, they shake their heads;
8 "Commit your cause to the Lord; let him deliver
let him rescue the one in whom he delights!"
9 Yet it was you who took me from the womb;
you kept me safe on my mother's breast.
10 On you I was cast from my birth,
and since my mother bore me you have been my God.
11 Do not be far from me,
for trouble is near
and there is no one to help.
12 Many bulls encircle me,
strong bulls of Bashan surround me;
13 they open wide their mouths at me,
like a ravening and roaring lion.
14 I am poured out like water,
and all my bones are out of joint;
my heart is like wax;
it is melted within my breast;
15 my mouth is dried up like a potsherd,
and my tongue sticks to my jaws;
you lay me in the dust of death.
16 For dogs are all around me;
a company of evildoers encircles me.
My hands and feet have shriveled;
17 I can count all my bones.
They stare and gloat over me;
18 they divide my clothes among themselves,
and for my clothing they cast lots.
19 But you, O Lord, do not be far away!
O my help, come quickly to my aid!
20 Deliver my soul from the sword,
my life[c] from the power of the dog!
21 Save me from the mouth of the lion!
From the horns of the wild oxen you have rescued me.
22 I will tell of your name to my brothers and sisters;
in the midst of the congregation I will praise you:
23 You who fear the Lord, praise him!
All you offspring of Jacob, glorify him;
stand in awe of him, all you offspring of Israel!
24 For he did not despise or abhor
the affliction of the afflicted;
he did not hide his face from me,
but heard when If cried to him.
25 From you comes my praise in the great congregation;
my vows I will pay before those who fear him.
26 The poor shall eat and be satisfied;
those who seek him shall praise the Lord.
May your hearts live forever!
27 All the ends of the earth shall remember
and turn to the Lord;
and all the families of the nations
shall worship before him.
28 For dominion belongs to the Lord,
and he rules over the nations.
29 To him, indeed, shall all who sleep in the earth bow down;
before him shall bow all who go down to the dust,
and I shall live for him.
30 Posterity will serve him;
future generations will be told about the Lord,
31 and proclaim his deliverance to a people yet unborn,
saying that he has done it.