The charges want to get as far away from the other charges as possible. If you are at a party with lots of people, and you don't want anyone next to you, you go stand in the corner. The tighter the corner, the fewer neighbors you will have.
Similarly, charges try to distribute to have the same potential - that is, the sum of the potential from one charge to all the others must be the same. When you are at a point with a lot of curvature, then if the charge density was constant there would be fewer charges in your vicinity. And it's the "near neighbors" that provide the majority of the electrostatic potential because of the inverse distance relationship. So in areas with high curvature, you have to pack the charges more closely in order to get the same potential.
I will leave it to someone else to give the mathematical derivation.