The big thing to know about Edmund is that, as Shakespeare repeatedly says, he's "a bastard." Not only was he born out of wedlock, but he also acts like a jerk from the beginning of the play to the end. He's one of the first characters we meet, and his father Gloucester goes out of his way to let us know that Edmund is his illegitimate son. Here's how he introduces his Edmund to a friend: "though this knave came something saucily into the world before he was called for, yet was his mother fair; there was good sport at his making, and the whoreson must be acknowledged."
Pretty mean. Imagine yourself at a party and your dad says: "Oh, here's my son, his mom was a whore, but we had fun together, so here he is." Would that make you mad? Would it make you want to get even? How about if it happened again and again? The play makes it pretty clear that this is a standard conversation for Edmund and his dad. So the first image in this play is a father smiling and abusing his son, and the son smiles right back, just soaking it up. When Gloucester insults his son, Shakespeare clues us in to the fact that Edmund is a jerk for a reason – as the illegitimate and second born son that's always the butt of his father's jokes, Edmund has been shafted his whole life. Here's what Edmund has to say about it:
[…] Wherefore should I
Stand in the plague of custom, and permit
The curiosity of nations to deprive me,
For that I am some twelve or fourteen moon-shines
Lag of a brother? Why bastard? wherefore base?
When my dimensions are as well compact,
My mind as generous, and my shape as true,
As honest madam's issue? Why brand they us
With base? with baseness? bastardy? base, base?
In the world of the play (which is much like Shakespeare's England), primogeniture (the rule by which eldest son inherits all his father's wealth, lands, and titles) is the rule and it makes the lives of younger brothers pretty miserable.
This means that Edmund has got some serious motives for acting like, well, a "bastard." (Don't get mad. This is Shakespeare's little joke, not ours.) So, no matter how bad Edmund behaves in the play, it's hard not to feel a little bit sorry for the guy. This is what distinguishes Edmund from the likes of some other Shakespearean villains. (In Othello, for example, we're never really quite sure what motivates the evil Iago – it's quite possible that Iago has no real motives at all.)
But this is Shakespeare, and let's face it, Edmund's a villain, and he's proud of that fact. So of course he has a plan to even the score, to punish both his father and his legitimate brother Edgar. (If you get these two brothers mixed up, just remember the "G" in Edgar for "good" and the "M" in Edmund for "mean" or "malice" or maybe…"misunderstood.")
And for all of Edmund's cruelty and manipulation, we can't forget that he attempts to save Lear and Cordelia. For the whole play, Edmund boasts about the evil that he does. It would make sense for him to go to the grave triumphant that he managed to have Lear and Cordelia killed even after he'd been defeated by his brother, Edgar. But this isn't what happens. Instead, he makes an eleventh hour attempt to save them before they're murdered by one of his soldiers. Edmund admits that this decision is totally out of character. "Some good I mean to do, despite of my own nature," he declares (5.3.12).
Edmund's rescue attempt is only half successful; his confession comes too late to save Cordelia. But his motivation for this sudden change of heart is very unclear. Edmund might be unexpectedly moved by Edgar's story of his father's death (5.3.16). Alternatively, Edmund's sudden generosity could be linked to his delight that, perhaps for the first time, someone loves him. Morbidly, this delight is over the deaths of Goneril and Regan, one of whom killed the other for his sake. Looking at their dead bodies, he boasts, "Yet Edmund was beloved" (5.3.15).
If you want to argue about it, you could say that Edmund attempts to save Lear and Cordelia because it is the kingly thing to do. Only a king has the ability to pardon those about to be executed. By attempting to pardon Lear and Cordelia, Edmund symbolically takes on the power of kingship. Edmund, originally just an illegitimate child and a social outcast, dies in command of the kind of power only held by those in the highest position.