I would like to know how does the kernel decide through which interface it sends data to some IPv6 address, how is the calculation done based on the routing table information:
That would be RFC 6724. From the abstract of that specification:
This document describes two algorithms, one for source address selection and one for destination address selection. The algorithms specify default behavior for all Internet Protocol version 6 (IPv6) implementations. They do not override choices made by applications or upper-layer protocols, nor do they preclude the development of more advanced mechanisms for address selection. The two algorithms share a common context, including an optional mechanism for allowing administrators to provide policy that can override the default behavior. In dual-stack implementations, the destination address selection algorithm can consider both IPv4 and IPv6 addresses -- depending on the available source addresses, the algorithm might prefer IPv6 addresses over IPv4 addresses, or vice versa.
It's quite a extensive algorithm, so I won't try to replicate its contents here. The link provided above is very stable and will not disappear :) Feel free to ask questions in the comments and I'll try to clarify the answer if something is not clear!