I only have a somewhat vague understanding how the electrical grid works. I know the basics of energy production, and that the electricity comes to our homes using power lines resting upon those big supports we see everywhere. I would imagine the grid somehow splits into smaller sections like a tree whose endpoints are the final destinations, such as single apartments.
This is more or less correct. In fact, you can extend your tree analogy down to the branch circuits off of your electrical panel and the devices you have plugged into them.
Let's say I fail to pay my electric bill and the power company decides to cut the electricity to my apartment. At what point of the grid is the electricity cut?
At the most practicable location. This can be an electronic remote switch in modern systems, and is often simply disconnected by a power linesman, either at the nearest utility box, or by physically pulling out your meter head.
The company knows my name and my address; so is there some kind of switch in my apartment building with my apartment number in it that the company comes to open? This is unlikely, since how would the company know somebody doesn't go and flip the switch again? Do they somehow control the flow of electricity from the power station? This is again seems unlikely.
Controlling the flow of electricity from the power station is actually what is accomplished by disconnecting the power by a switch or other means. The most important thing to note about the means of disconnection is that it is accessible by the power company, but not by the end user or building maintenance, etc.
Then adding to my confusion is the fact that there are of course multiple power companies, but there seems to be only one electrical grid.
In many areas in order to theoretically increase market competition governments force the company that owns and maintains the grid to allow others to subcontract the sale of electricity.
How does the company for which I'm paying the bill know that electricity produced specifically by them reaches MY apartment?
The power companies don't need to track individual electrons because power use by each customer is measured, and the total output of each generator on the system is known. From this data, power companies can figure out transmission losses.
The companies that don't own the system but sell electricity are acting as a middleman and the only thing of real significance to note as a result is usually that it may actually be cheaper for you to utilize a middleman, which is somewhat counterintuitive.