Late stages of stellar evolution