Most communities say Psalm 27 twice a day, morning and evening, from the beginning of the month of Ellul through Rosh Hashanah and Yom Kippur, ending on Shemini Atzeret at the end of Succot.
The custom is recent. It is not in the Shulchan Aruch; the Mishnah Berurah (early 20th century) mentions it as "our custom", suggesting that there were others who didn't follow the custom (Orach Chayim 581:2).
Why this psalm? There is a midrash that interprets the opening line "God is my light and my salvation" as referring to Rosh Hashanah and Yom Kippur respectively. My sense, for what it's worth, is that it's the spiritual mood of the whole psalm rather than this or that word that helps prepare us for the Days of Awe. Interestingly, there is no explicit reference to sin, guilt, or repentance. Rather, the insistent themes are a mighty yearning to come closer to God and faith that God can and will remove obstacles to approaching Him if we sincerely strive to do so.