If I have a post in multiple categories, what defines what category shows up in the URL? Assuming I have permalinks setup as
/%category%/%postname% is it the ID or the name?
WordPress always use the category with lowest ID. You can use plugins such as the Hikari Category Permalink plugin to change that however.