What are applications locked against? ROM, phone ID, or google account? If I bought an app, is it locked to the specific installed android ROM, to the hardware (phone) or to my Google account?

Basically I want to know what would happen to my paid apps when I would reinstall the ROM, or change my phone. Could I re-download my apps?
When you wipe your phone and re-install a ROM, or switch to a new phone, you will be prompted to sign in with your Google account. As long as you use the same Google account, you will be able to find your purchased apps in the Market by pressing the Menu key and selecting My Apps, or something similar (i believe they're named differently in different versions). From there you will be able to view and re-install previously purchased apps.

NOTE: This only works for apps you've spent money on. If it was free, it will not be stored on your account in this way.