When to use 于 and not 於 in traditional Chinese? On my last question, there is a hint not to treat 於 as the traditional variant of 于。However, my keyboard (Tw) never proposes 于。 

I also noted that the commentary on the 學而 on this site uses 于 twice. The text and commentary combined use 於 nine times. Can anyone enlighten me?
This answer details a bit of history of the development of「于」and「於」, and addresses why they overlap. It is purely meant to be a complement to @user3306356's answer, which has responded to the question directly.



In the Modern Chinese language shared across all Chinese-using regions,「于」and「於」largely represents the same overlapping preposition/adposition function. For this function only*, any proposed "rules" specifying the difference in usage between the two are very unlikely to be accepted across all Chinese-speaking regions, mainly complicated by the fact that PRC has made「於」obsolete and Taiwan has a habit of using「於」and not「于」. This is also why you wouldn't find「于」on all but the most thorough Taiwan-Chinese input methods.



「于」and「於」are both phonetic loans; they both originally represented something else.


  Glyph origin of 于
  
  「于」was originally a picture of a wind instrument:
  
  
  
  It was later simplified to
  
  
  
  then further simplified to「于」. The original sense of the wind instrument is now written「竽」after「于」became extensively used for its grammatical function meaning and had lost its original meaning.
  
  Glyph origin of 於
  
  「於」and「烏」were originally the same character, but have been graphically differentiated. For reference, their development looked something like
  
  
  
  
  There was absolutely no difference between the characters「於」and「烏」before the Qin dynasty, and「烏/於」was used for its current grammatical function long before they became different characters.




The historical usage of「于」and「於」goes in accordance to something like the following timeline:


Western Zhou


Only「于」is used for the grammatical function.
During the same period,「於」is used as an exclamation.
This is especially obvious when both「于」and「於」appear simultaneously: 

Late Western Zhou to end of the Spring and Autumn period:


「于」sees an additional use of a filler syllable to match rhythms across commonly used phrases.
「於」gains the grammatical function of what was previously「于」, but「于」still sees higher usage frequency for this function, and there is no difference between the two in this context.
「於」still kept its previous meaning (as an exclamation).

Warring States and later:


「於」overtakes「于」in frequency in the grammatical function sense, but both were still used and neither was permanently dropped.



See also 從“于 / 於”用法上的變化看複合詞“於是”的產生.



*There are differences between「于」and「於」when they're not used in the grammatical function sense, which this answer touches upon but doesn't explain thoroughly - detailed dictionaries will provide a more comprehensive explanation.