Ledavid Hashem Ori: Siddur Admur; Chemdas Yamim 1 p. 106 [That he would say by Selichos]; Moreh Baetzba 37; Shaareiy Rachamim [Chaim Kohen]; Sheim Tov Katan; Siddur Haari of Rav Shabsi; Shaar Hateshuvah 1/41 brought in Shaar Hakolel 11/28; Mateh Efraim 581/6; Kitzur Shulchan Aruch 128/2; M”B 581/2; See Divrei Yosef [Bnei Brak 1987] p. 163-185 for a full overview on this subject.
This custom is not found in Poskim or in the classical Sifrei Kabala. [Shaar Hakolel 11/28] Some say the source for saying this psalm is from the Midrash Seichel Tov which states that “Uri” is Elul, and “Yisheiy” is Rosh Hashanah, “Yitzpineini Besuko” refers to Sukkos. [Mateh Efraim in Alef Lamateh 581/6; Kitzur ibid] Others however negate this explanation as there are many verses that refer to Rosh Hashanah and Yom Kippur and nevertheless we are not accustomed to read it during Elul. [Shaar Hakolel 11/28] The first to mention this custom is the Siddur of Rav Shabsi Rashkovir and from there it was printed in all the Siddurim to recite in the month of Elul. Seemingly he was the innovator of this custom due to the great Segulos he writes about it, or perhaps he received it as a personal tradition from his Rabbis. [Shaar Hakolel ibid] This custom is mentioned in the Chida [Moreh Baetzba 1/37] and is brought in the following Sefarim written by students of the Arizal: Shaareiy Rachamim [Chaim Kohen]; Sheim Tov Katan. It is also brought in the Sefer Chemdas Yamim 1 p. 106 which is of questionable legitimacy. Based on this it seems that this custom was first introduced only starting 300 years ago. [Divrei Yosef ibid]
Other customs: Some have the custom not to recite this psalm during Davening in Elul. [Maaseh Rav 53 brings the Gra would not recite it; Siddur Leiv Sameich brings that Hayehudi Hakadosh and the Chozeh Melublin did not recite it. Reb Chaim of Tzanz did not recite it. See Divreiy Moshe 134; Piskeiy Teshuvos 581/11 footnote 73-76] Some say the reason for this omission is because the saying of this psalm in Elul was not brought within the writings of the Arizal or in the Shulchan Aruch. It is rather sourced in the Sefer Chemdas Yamim which is debated whether the author was a follower of Shabtai Tzvi. [Some say its author was Nathan of Gaza.] Now although its source has been found in other places, nevertheless the source for it to be said within prayer is from the Chemdas Yamim. [Divreiy Moshe 134; Piskeiy Teshuvos 581/11 footnote 73-76] This however is incorrect as the Chemdas Yamim does not even state to recite it during Davening but that he had a personal custom to say it during Selichos, hence certainly the source for our custom is not in the Chemdas Yamim. [Divrei Yosef ibid]
 Psalm 27
Its meaning: The psalm contains 13 names of Hashem in correspondence to the 13 attributes of mercy which are revealed in the month of Elul. [Siddur Reb Shabsi ibid, brought in Shaar Hakolel ibid; Panim Yafos Vayikra 16/21]
 Sefer Haminhagim 112; Hayom Yom p. 83
Other opinions: Some Poskim rule that we begin saying it from second day of Rosh Chodesh. [Kitzur Shulchan Aruch ibid]
 M”B 581/2; See Shaar Hakolel 11/28
 Siddur Admur; M”B 581/2; Siddur Beis Yaavetz-additions of the editor; See Divrei Malkiel 6/23-2 for an explanation on this matter; See Glosses of Rav Raskin footnote 472 that explains perhaps the custom used to be to say it after Maariv during times that Maariv was Davened during the day, however today that we Daven Maariv always at night, since we cannot read Tehillim at night it is said after Mincha.
Other Opinions: Some are accustomed to say Ledavid after Maariv [Alef Hamagen 581/6; Divrei Malkiel 6/23-2 [Minhag Ashkenaz]; See Kitzur Shulchan Aruch 128/2 which says “morning and evening” However see M”B 581/2 that states “evening” here refers to Mincha.]
 Mateh Efraim 581/6; M”B 581/2; Siddur Beis Yaavetz-additions of the editor; Glosses of Rav Raskin on Siddur footnote 469 based on Luach Kolel Chabad.
The reason: As Rosh Chodesh is more common and hence its Psalm of Barchi Nafshi is to be recited first. [M”E ibid]
 Siddur Admur; Chida in Moreh Baetzba ibid; See Shaar Hakolel 11/28; 45/6 that the Segula of Ledavid applies only until Hoshana Raba as on Hoshana Raba the judgment is complete and we no longer need to ask Hashem to prevent the Kelipos from nurturing from holiness.
Other Opinions: Some Poskim rule that it is said until Shemini Atzeres, including Shemini Atzeres. [Siddur Reb Shabsi; M”B 581/2; Sheim Tov Katan; Siddur Beis Yaavetz-additions of the editor] Some rule it is said only until Yom Kippur. [brought in M”B ibid;See Shaar Hakolel 11/28]