You file a flight plan with your departure point and destination, as well as a few other things (
link), and once it's filed, after a short period of time, it is in the computer systems of the controllers, so once you take off, or before you take off, you contact your nearest approach or center controller, and they issue your clearance based on your flight plan. Once that is done, they expect you to fly the plan as you have filed it, or, if they have changed it, as they requested. When you file IFR, you are usually in contact with a controller for most of the time, so they always have a pretty good idea of where you are. However, if you don't file a flight plan, you can still call up an approach controller while you're outside of their airspace, and request clearance into their airspace, and usually, they'll give it to you, unless they're very busy or something. Once you establish contact with them, they'll sometimes give you directions on where to fly, so they'll know you are.
So, to sum it up, they often times know you're coming because you said so in your flight plan, but if you don't have a flight plan, they might not know you're coming until you're 20 or 30 miles away from them.
That was very poorly written, but I hope you understood, even with my extreme comma usage tonight, here, now, so goodnight.
