I work for clients at 6-12 months stretches as an independent contractor. Sometimes longer. And when I part with them I usually stay around on a monthly retainer. The retainer then keeps me in the loop with them, and I often get billed for smaller tasks their team can't address, or needs extra capacity on.
Through a lot of trial and error, coming up from sites like Upwork, Fiverr, etc. That's the only way I feel that "freelancing" works for me. Where I am deeply networked and have already build rapport with the clients.