Having checked various sources, I will share with you the comments made by our sages. The majority opinion is that these students of Rabbi Akiva were guilty of stingeness. They were disappointed and dissatisfied with the success of others in Torah studies. They looked grudgingly at each other and their selfishness was their downfall. They were jealous of each other and lacked unity. They were not greeting each other with respect nor accepted others opinions and felt that they were right in all aspects. So they were punished and they died.
But to this view point, I have the following questions - how could all the students commit the same sin at the same time? Rabbi Akiva taught to love and care for each other so how could his students miss this important lesson? Was it not the failure of the greatest teacher in Jewish education? Why mourn for such students who did not learn the basics from their teacher? Is there capital punishment for those who disrespect each other? If rabbi Akiva was not able to influence his students then wasn't death deserving for the students?
The Gemara talks about a moral dilemma wherein when two people are traveling in a desert and only one has a water bottle. One opinion is that he should share the water with the other than watch the other die. But in this way, both will die eventually. The other opinion is of Rabbi Akiva that says that I am First so I will drink and survive.
The students of Rabbi Akiva were the soldiers in the Bar Kochba revolt. We read in the Hagaddah that students came to attend the seder of Rabbi Akiva. They were discussing about the Exodus from Egypt the whole night until their students came at dawn to tell them that the time for Kiriat Shema had come. Actually they were discussing about the rebellion. That was a cover up and the code to the call of Kiriat shema was the readiness of students to accept the yoke of Hashem and to fight against the Romans.
The students went to war with the Romans but with a wrong philosophy of Rabbi Akiva. I am First only in times of peace but in times of war the soldier has to think about his fellow soldiers. This kavod was missing in the battle and they did not conduct nicely with each other.
So the students were holy men and martyrs who were killed in the war and hence we have semi mourning for them. Rabbi Akiva was the best teacher.
Actually the period between Pesach and shavout was very harsh for the Jews. They were the days of judgement and persecution. Crusades, pogroms and blood libel against the Jews took place during that period along with the death of 24,000 students of Rabbi Akiva and hence we mourn for their deaths.