Say the death penalty was given to people who have done mass shootings. Wouldn't you think they would shoot themself after they are done? If the shooter really wanted to kill people and knew they would be sentenced to death for doing it, they would most likely take their own life so they don't have to go through the process of being sentenced.
Like Hadzz said, some do it to become known. It may not be the greatest thing to be known for, but their name will go down in history and will forever be known. This is why some do not like the idea of putting the face and/or name of the shooter on the news.