'Whom they have pierced'
Jerusalem's mourning for a slain figure in Zechariah; John applies the verse to the crucified.
Zechariah 12:10
10I will pour on David’s house, and on the inhabitants of Jerusalem, the spirit of grace and of supplication; and they will look to me whom they have pierced; and they shall mourn for him, as one mourns for his only son, and will grieve bitterly for him, as one grieves for his firstborn.
John 19:34-37
34However one of the soldiers pierced his side with a spear, and immediately blood and water came out.
35He who has seen has testified, and his testimony is true. He knows that he tells the truth, that you may believe.
36For these things happened that the Scripture might be fulfilled, “A bone of him will not be broken.”
37Again another Scripture says, “They will look on him whom they pierced.”
What each tradition says
Rabbinic / Midrashic
Rashi, transmitting the Sages of Sukkah 52a, says the mourning in Zechariah 12:10 is as a man mourns over his only son. He reports that they expounded this as referring to the Messiah, son of Joseph, who was slain.
Rashi (R. Shlomo Yitzhaki, 1040-1105), transmitting the Sages of Sukkah 52a, Rashi on Zechariah (The Judaica Press complete Tanach with Rashi, trans. A. J. Rosenberg) — Comment on Zechariah 12:10 (note on 'as one mourns over an only son')
Rabbinic / Midrashic
Rashi explains “they shall look to Me” as looking to God in order to complain about those of them whom the nations thrust through and slew during their exile. The look is a complaint to God concerning those slain by the nations in exile.
Rashi (R. Shlomo Yitzhaki, 1040-1105), Rashi on Zechariah (The Judaica Press complete Tanach with Rashi, trans. A. J. Rosenberg) — Comment on Zechariah 12:10 (note on 'they shall look to Me')
Patristic
Irenaeus says those who declared regarding Him, “They shall look on Him whom they have pierced,” indicated His second advent. He Himself speaks of this advent when He asks whether the Son of man will find faith on the earth.
Irenaeus of Lyons (c. 130-c. 202), Against Heresies, Book IV, ch. 33, in Ante-Nicene Fathers, vol. 1 (Buffalo: Christian Literature Publishing Co., 1885) — Book IV, ch. 33, §11
Catholic
The Catholic Encyclopedia reads Zechariah 12:10 typologically: Yahweh, whom the people pierce, is the type of Jesus, and Jerusalem's prayers and grief over the wrongs done him are typical of the Messianic kingdom. Jerusalem's mourning prefigures the mourning Jesus will inspire in the Church as its members look upon him whom they pierced (cf. John 19:37).
Catholic Encyclopedia (1907-1912), article 'Zacharias', The Catholic Encyclopedia, vol. 15 (New York: Robert Appleton Company, 1912); New Advent edition — Article 'Zacharias' (the prophet), on Zechariah 12:10 and John 19:37
Orthodox
Cyril states that this shall appear again with Jesus from heaven, for the trophy shall precede the king. So that, seeing Him whom they pierced and knowing by the Cross Him who was dishonoured, the Jews may repent and mourn.
Reformed / Protestant
Calvin says this passage is violently tortured by those who try to explain it literally as referring to Christ. He argues the Evangelist does not quote it for that purpose, but to show that Christ is the God who formerly complained by Zechariah that the Jews had pierced his heart.
John Calvin (1509-1564), Commentary on the Gospel according to John, vol. 2 (trans. William Pringle; Edinburgh: Calvin Translation Society) — Commentary on John 19:37
Evangelical
Barnes is struck by God’s wonderful providence that so many scriptures were fulfilled in his death. These things happened without any such design by the men involved; whatever was done by Jew or Gentile tended to fulfill prophecies long on record, with which the Jews ought to have been familiar.
Albert Barnes (1798-1870), Notes on the New Testament, Explanatory and Practical (enlarged ed. by Robert Frew; CCEL carries the Baker reprint) — Note on John 19:37