Basic Points
To begin, we need to remember something very basic, that is nevertheless taken for granted by modern readers: the ancient world didn't have audio recording. In the specific case of Acts 2, Peter's speech is portrayed as an impromptu reaction to accusations of drunkenness. It is unreasonable to expect the passage to contain a verbatim record of what Peter said.
That said, historical criticism of the speeches in Acts largely depends on a close examination of vocabulary, grammar, and style used in the speeches, in comparison and contrast with the author's own narration. This is because the author and the speakers would have their own distinguishable speech patterns.
If there is virtually no difference between the narration and the speeches in terms of vocabulary, grammar, and style, it would be a sign that the speeches were worded and shaped by the author. This would not necessarily mean the speeches are a complete fabrication by the author. It could easily be that fuller speeches were summarized, condensed, or reshaped to fit into his narrative.
However, if there are clear differences, it could be a substantial sign that the speeches came from an older source. This is assuming the author didn't consciously alter his writing style when it came to dialogue, which some have suggested.
Peculiarities
The speeches in Acts do, in fact, contain some peculiar features that indicate the author was not pulling the speeches out of thin air to suit his narrative or his theology.
For example, Luke-Acts uses the Greek word for 'heaven' (ουρανος) 63 times, give or take a few depending on manuscript tradition. However, the author uses the word in the plural form only five times in Luke (10.20; 11.2; 12.33; 18.22; 21.26) and only two times in Acts (2.33; 7.56). This is unusual for the author, since he actually changed the 'heavens' to the singular 'heaven' in some of his parallels with Mark and Matthew (Luke 3.21-22; 6.23; 11.13; 15.7) to conform to his own natural writing style. All seven instances of the plural 'heavens' in Luke-Acts occur within speech from Jews (Jesus, Peter, and Stephen), not from the author's narration.
Taking note of this peculiarity, Zwiep examines the phrase 'ἀνέβη εἰς τοὺς οὐρανούς' in Acts 2.34 and suggests Peter's speech is pre-Lukan in origin, saying:1
Luke never uses ἀναβαίνω in connection with the ascension and he has a
pronounced preference for the singular οὐρανός instead of the plural
οὐρανοί. Luke is likely to have taken up this phrase from his source,
presumably from a Jewish-Palestinian milieu. Since Luke did not
assimilate the words to his own idiom, we may assume that he uses the
traditional wording.
While discussing the apocryphal Didache, Robinson notes that the book's 'prayers and thanksgivings are full of archaic terminology'. He specifically notes how the Didache calls Jesus the 'servant' (παῖς) of God, pointing us back to Peter's speeches in Acts 3 and 4. Robinson suggests such vocabulary represents 'the earliest Christian liturgical language', bringing us back to early material.2
In the same line of thought, Green writes:3
The doctrine in these sermons is quite unlike that of Luke himself. He
certainly did not think of Jesus as simply 'a man approved of God',
'the prophet', 'the righteous one', 'the prince (or "originator") of
life'. His own theology did not expect 'times of refreshing from the
presence of the Lord that he may send the Christ appointed for you';
his eschatology was of a different order. Long ago Harnack was greatly
impressed by the antiquity of the title 'servant of God' used of Jesus
in the speeches of Acts but nowhere else in Luke, and Cullman and
Jeremias agree with him. The attempt by Wilckens to evade this point
has been capably refuted by Dupont. Certainly the appearance of a
'different' theology in the Acts sermons need not necessarily mean
that it is ancient; but when taken with the Aramaisms and the very
Jewish nature of the doctrinal formulations concerned, the presumption
is strong that we have here something very old.
Green goes on to say:4
we may with some confidence accept the sermons in Acts, not indeed as
a transcript of what was said, nor even as a summary of the addresses
(so thoroughly has Luke conformed them to his own style), but as a
reliable sample of the way in which the early Christians set about
convincing first the Jews of Jerusalem, then proselytes like
Cornelius, then Diaspora Jews and finally Gentiles from varying
backgrounds, of the truth of the Christian proclamation.
Conclusion
Based on the evidence of vocabulary and style, the speech in Acts 2, while likely not a verbatim record of Peter's own words, may rest on a core mode of thought and set of language used by Peter and/or his fellow Jews, and was intended by the author to accurately represent the type of thing he would have said in that time and place and situation. This seems to be the general perspective on speeches in ancient Greco-Roman historiographies, so Luke is not unusual here.
Sources
1 Arie W. Zwiep, The Ascension of the Messiah in Lukan Christology, p. 155-156.
2 John A.T. Robinson, Redating the New Testament.
3 Michael Green, Evangelism in the Early Church, p. 104.
4 Ibid., p. 105.