In traditional Chinese, when should one write 台灣 and when should one write 臺灣?
The spelling 「台灣」 is not official in Taiwan, and receives no entries in the Republic of China's Ministry of Education dictionaries (萌典, 教育部重編國語辭典修訂本, 教育部國語辭典簡編本).

Its prevalence in online media is most likely due to IMEs listing 「台灣」 before 「臺灣」 in Taiwanese phonetic input systems when typing "taiwan" or "ㄊㄞㄨㄢ" on a computer.* This has nothing to do with handwritten simplifications, as things like 「身體」, 「學習」, etc. do not appear as 「身体」 or 「学習」 in Traditional Chinese websites.

Even though one "shouldn't" use the spelling 「台灣」, everyone recognises what 「台灣」 is supposed to be, and this spelling is overwhelmingly prevalent in Taiwan itself, so it doesn't really matter (except when referring to governmental agencies). I would just be cautious in its usage, as the overwhelming (and erroneous) prevalence of 「台」 for the name Taiwan has led people to forget that 「台」 is properly pronounced in the first tone as tāi when used in proper nouns and never as tái.



*This is true from personal experience. Ironically, using a PRC input system set to Traditional Chinese will only list 「臺灣」 and not 「台灣」 when one types "taiwan".