Should Leshem Yichud be said before Mitzvos or not?
(Disclaimer: The below is based on a שיעור I heard several months ago on the topic and may be biased but includes some useful information.)
Saying a paragraph preceding doing a מצוה to state one's intent accomplishes one or both of two things:
Ensuring that one has the correct intent just in case מצוות צריכות כוונה - mitzvos need [to be carried out with] intent.
-- According to the Shulchan Aruch Orach Chayim 60:4 they do:
י"א שאין מצות צריכות כוונה. וי"א שצריכות כוונה לצאת בעשיית אותה מצוה, וכן הלכה.
Ensuring that one accesses the desired metaphysical effects of מצוות known as "כוונות", which are interdependent across the spectrum of commandments and cannot fully be accessed consciously by the average person because they are so esoteric. (See the text of the לשם ייחוד paragraph that appears in many סידורים.)
When it comes to the former, some have suggested, including the ריטב"א on פסחים ז עמוד ב that the mechanism ensuring and clarifying that we have intent to fulfill מצוות when we do is the recitation of a ברכה before doing them:
וכתב הרי"ט ז"ל וטעם זה שאמרו חז"ל לברך על המצוה עובר לעשייתן כדי שיתקדש תחלה בברכה ויגלה ויודיע שהוא עושה אותה מפני מצות השי"ת
And as far as the second reason goes, many have argued and held in the past that since the paragraph basically expresses the fact that we wish to access the very metaphysical forces that we consider ourselves unable to access, saying it either doesn't work or is more of a תפילה that our מצוות be effective in general and therefore is sufficient to be said once a day. This is the reason that a number of סידורים print it (or something like it) just once at some point toward the beginning of davening. E.g. The בעל התניא had it before ברוך שאמר; the "סידור וילנא" has it before putting on תפילין, etc.
For reasons of superfluity and the risk of casting aspersions on previous righteous generations who did not say it, the Noda' BiY'huda - Yoreh De'a 93 (first edition) proclaims in no unscathing terms that לשם ייחוד should not be recited. He endorses saying a brief formulation before active positive commandments that do not already have a ברכה attached (confirming the ריטב"א's logic above?) to the effect of "I am about to do what God commanded."
Ask your local competent legal and practical authority.
It depends on the mitzva, I found that some sidurim brings leshem Yichud for some mitsvot that other sidurim don't. In any case there are places that it is not applicable like Havdala.
Al Pi Kabbala one should say Leshem Yihud for every Miswa (More BaEsba 1:1, Kaf HaHaim P. 1:1). However, Harav Dawid Yosef (Shu"t Oserot Yosef vol. 1 ) Paskens that saying Leshem Yihud prior to any Miswa is "MiMidat HaHassidut" (a stringency).