TL;DR: Everybody likes it if one appreciates their work. As long as you write honestly, informatively, and without further agenda, this is welcome and helpful. Don't worry about making it useful beyond the personal appreciation.
Scientists do their work because they like it and/or feel the need to do science - they do not (and should not) expect thanks beyond citations, invitations to talks, tenure, i.e. collecting the usual experience points of the academic dungeons and dragons game which can be turned into tangible uplevelling.
That being said, someone who expresses their real appreciation their work because it is particularly well done, or even just well written, is a welcome and unusual surprise.
If you write, don't be generic. Explain what in the paper was helpful, how, and why. State whether it was the writing of the paper, the organization of the material or whatever else that made it so useful to you.
The reason for that is that, not only does it show that you had a particular reason for praising the paper (rather than trying to ingratiate yourself), but it also helps the author understand what features of the paper were useful so that they can try and keep improving their future work (or keep doing it, at least) in that direction.
Additionally, note that they may have been criticized by a reviewer before for precisely those things that you liked about the paper (this happens more often than one would like; one reason why peer review is more often than not a lottery, especially in competitive venues); with only the reviewer's comment in mind they might be tempted in future not to write things this way - you would show them that there are readers that may actually profit from this style of presentation. While this does not resolve the authors' dilemma in what audience to write for, it gives them additional information to operate with in the future.
What not to do:
if your priority is to write about how much you enjoyed the paper, do this, but do not carry a secondary agenda beyond a friendly thanks/compliment/feedback to the author.
If you primarily want a collaboration, write a mail suggesting initiating a conversation or collaboration, only citing the paper as an inspiration for you to initiate this contact. That's fine. What's not recommended is to write effusively about the "great paper" only to insert some possibility of future collaboration. This looks weird and, to be honest, sycophantic [here I agree with Buffy], if not creepily indirect.
Your mail should reflect what you want. Don't mix agendas.
Don't bother thinking about how to make the letter formally valuable. If you are not in an academically advanced position to write a reference to the author, you probably don't have the clout to do so, anyway - and that's not a bad thing, you'll have to do enough of these at some point, anyway. By feeding back that you enjoyed the paper, and why, you have done your part to help the author continue to do good work. And, in the end, that's what really counts.
[Thanks to Bryan Krause for this one:] do not expect a response. You may receive one, but should understand from the outset that your mail is likely to be a one-sided communication, at least on the immediate level. If you did your due diligence in highlighting what you liked about the work, you still have done your best in making the day nicer to the author of the paper and signalling what achievements you'd enjoy seeing repeated in the future.