Is it allowed for a Jew to whistle? If yes, is it even allowed on Shabbos? If no, why not? Has anyone ever heard that if one whistles at night, that it attracts sheidim and mazikin?
And what are the sources for any answer.
It says clearly in Hilchos Shabbos that it is Muttar (Shulchan Aruch Orach Chaim Siman 338:1). I don't know of anybody who argues.
There are videos of the Lubavitcher Rebbe encouraging whistling by his farbrengens.
Edited to add some great links from the comments into the answer, as well as other sources:
Here is a picture of the Rebbe's often-used hand motion to signal for whistling.
Here is a link to a first-hand account of the Rebbe encouraging someone to sing, along with a picture of the Rebbe giving the signal to whistle.
Here is a link to a video that includes many people whistling while the Rebbe urges them on, but no actual prompting from the Rebbe is shown. (Skip to the middle for the whistling).
I had a high-school rebbe (sophisticated in both Jewish and worldly matters, by the way) who was very against whistling at any time, because he had learned from his rebbe (I forget who, unfortunately) that it would attract demons. He would say in Yiddish "Yidden fife nisht," or "Jews don't whistle." I don't remember him distinguishing between night and day.
After he'd told us that, I was once absentmindedly whistling in his presence, and he turned white and asked me to stop.
Sorry, I don't have any sources for you.
For Sephardim: Allowed on Shabbat and other days, but not in public.
Source: Daily Halacha by R. Eli Mansour says
The Halachic authorities rule that whistling was not included at all in the decree against producing sounds on Shabbat, and one may thus whistle a tune on Shabbat. We should note that irrespective of the laws of Shabbat, whistling in public, such as while walking in the street, is improper and unbecoming of a Torah Jew. But if at home one wishes to whistle as background to the singing of Pizmonim (hymns) at the Shabbat table, this is certainly acceptable and permissible.
R. Hershel Schachter records that old people from Europe would say that only non-Jews whistle and that it is especially forbidden on Shabbos due to the creation of sound, to which R. Joseph B. Soloveitchik pointed out that Shulchan Aruch O.C. 338 allows whistling on Shabbos so there is no problem of creating sound, and it would certainly be permitted during the week and is not a problem of following the ways of the non-Jews:
Divrei Harav p. 197
מרגלא בפומייהו דאינשי (יהודים זקנים מאירופה היו אומרים) שרק נכרים שורקים בפיהם (גויים פייפען) אבל לא יהודים ובמיוחד בשבת שיש איסור מטעם משמיע קול ורבנו העיר שבשו"ע או"ח (סי' של"ח) מבואר (בשם השלט"ג סוף מס' ערובין) שז"א דאף בשבת שרי ואין בו משום משמיע קול ק"ו בחול דשרי ואין בו משום חוקות עכו"ם (שמעתי מדודי הרמ"א מאזעסאן ז"ל