In order for a composite filling, sealant or other bonded material to adhere to the enamel, the surface is "etched". This is usually done by applying 37% phosphoric acid solution for about 15-20 seconds and then rinsed off. (No the acid does not hurt. In fact, you can touch it for a good while and nothing will happen. It's acid, but not that strong). The etchant removes inorganic material and parts of the enamel rods whose ends are exposed by demineralization. Yes, if you put an egg into vinegar it will eventually demineralize the eggshell. Same thing here, but a much shorter time, stronger acid and it's only the microscopic surface that is demineralized. This etching produces multiple areas for bonding material to mechanically adhere to the enamel surface. Visually the tooth has a frosted appearance. It's sort of like sandblasting or priming the surface. Bonding agent is then applied, flowing down into this rougher surface. Once curing occurs, this locks into the undercuts, and bonds the material to the tooth.
Dentin can also be etched, but the bond strength is less than with the enamel. It is much more organic with dental tubules evident on microscopic view. Newer bonding agents bond to enamel and dentin. You can see from these photos how the surface is primed for bonding.
Here is a good slide show on enamel: Enamel HistologyA good summary of the status of enamel and dentin bonding: JADA Article
Now, is the histology of enamel different with enamel flourosis? with hypoplasia? Basically, yes. That would be whole other post.