Having gotten and let expire a few clearances over the years, I can answer a few of these.
Once you are given the clearance, it is yours, you are the one cleared, not the company. If you are not offered a position, but were granted the clearance, you will be able to apply at other positions with the same clearance requirements. The new FSO will just "transfer" (lack of a better term) the clearance over to them.
If you are fired or otherwise leave the company, I am not sure exactly what they call the status of the clearance at that point, but for all practical purposes it is active (or idle or something, but readily re-activated) for 2 to 5 years depending on the nature of the clearance.
If you go to another company that does not need the clearance, no upkeep will happen and if you don't use the clearance within the expiration period, it will expire. That said, if you have had one before, companies are more likely to take the chance on you getting one again.
Clearances are very expensive, although the lower level secret or government trust (non DoD type, but still government) will cost less. It is hard to say if they will have "hostility" to you or not, that will depend on the reason you did not start with them after they applied for the clearance.
It has been my experience, that companies will hire you and have you start while the paperwork is in process. Typically though they will wait for what is known as an interim clearance, basically a simple background check that will be issued in a few weeks. This means that things look good, and you will likely get your clearance so the company can have you start, although you don't actually have your clearance so you won't be able to access classified information yet.
I have never had a company put in for a clearance unless they intended to hire me. So unless you get denied, I would think that you will be hired once they receive either the interim or full clearance. Secrets don't take all that long, so it is possible they may wait for the full clearance to come in, especially if they would have no other role for you should it be denied.