How to use Lili's W effectively?
There's two answers to this question, depending on if you pick Mending Serpent(each attack gives a small heal to the target ally) at level 4.
I didn't pick Mending Serpent: You're on the right track. You want to put this on whoever is in range and will stay in range to get maximum use from it.
I picked Mending Serpent: Now you have to be more thoughtful about your usage. You still want to pick someone who will be in range to use it so they receive the healing, but now you need to think about who will get the most use from the healing. A good use is casting this on someone who is about to be out of range of your healing brew. Example: A fight is starting and you have Anub'Arak on your team. He is probably going to burrow towards their backline, but you need to stay near your backline to keep your assassins healed. Anub'Arak is a good target for Mending Serpent, since he will get good use from the damage and healing by staying in range.
Cloud Serpent is basically a DPS buff, but you should be considerate of the auto-attacking mechanic.
In most cases, you just want to apply it to allies or yourself if they/you are within range of combat. However, since it auto attacks, this can also be a great deterrent when running away, since you or an ally can focus on moving away while the serpent deals some light damage, essentially kiting, hopefully convincing any pursuers to break chase and heal.