I typically quote on a project by project basis so the client knows what it's costing up front. It's basically guesswork based on a number of factors, sometimes I come out on top and sometimes I get reamed. As long as it evens out in the long run then I'm all good. That's the theory anyway.
I have a couple of clients who I just invoice the hours upon completion but it takes a while to develop that relationship and there's generally some discussion of how long it's likely to take up front. If they get killed on a job I'll try and look after them on the next and vice-versa. If they're ongoing clients I'm happy to take some hits to keep the relationship solid.
When I say hits I'm talking 10-20%, not 50%. If I'm out by 50% (or they are) then we're having a serious miscommunication and need to resolve it.