Inspired from this question, I think the reverse can be an interesting discussion so I will set up an artificial example.
Suppose I cite XYZ in a published or under review paper. I am not affiliated or have had past contact with the author(s), so we are personally unknown to each other. This can also include a passing chat in a conference/ seminar, but certainly not something regular or memorable. For ease, let us assume that the citation is of some importance, i.e. it is a key paper and my work relies on it, or the results/ methodology are related. This, therefore, excludes "lit review" or "professional/ courtesy/ standard" citations. My intentions are honest: I genuinely intend to say "thank you, your work is good and it helped me a lot, feel free to contact me in the future" and do not intend to trade citations, disguise a suggestion (Trojan horse) or have a hidden agenda. I would be happy to discuss further, or end up working with XYZ in the future, but the purpose of the email is not that.
Given the above, is it good practice to politely email, Tweet or PM the author(s) with something along the the following lines?
I found your paper XYZ to be interesting and relevant to my work, and I cited it in my recent paper ABC. My paper is related to yours in Way 1, Way 2 and Way 3. I believe you would be happy to know that a colleague found your work to be useful and I took the liberty of contacting you. Please consider me open for future contact and feel free to email me with any thoughts you may have.
If yes, when is that true? Conversely, under which circumstances can such an email be seen as unprofessional, impolite or suspicious? Are such emails considered sound academic/ professional practice, or is there a danger to be misunderstood, appear offensive or seen as having other intentions? Basically, is it a good idea or will it backfire spectacularly?