The behavior of chemical elements in stars