You shouldn't really have anything in your web.config concerning domain. In Kentico you just use your "Sites" to add a new site, and as long as IIS allows the domain and you have a license it works.
Can you paste what domain-specific web.config key you placed?
To answer your 2nd question, IIS (if it has multiple bindings to the same Kentico Site) will send a request to the kentico instance with the domain (IIS tells Kentico "there's a request for you for www.domainB.com")
Kentico looks at the Sites it has defined in the Sites Module, and if it finds a Site with that domain (or domain alias) it says "Oh, i have that site, let me give you the content."