Who are essential and will not attack you (purposely)?
[Essential] means they cannot be killed [...] and when their health bar fully depletes, they will merely fall into a state of recovery for a short time [...].
http://www.uesp.net/wiki/Skyrim:Essential_NPCs
A key criterion of my question is the fact that essential NPCs can still be hurt, allowing one to grind skills that require inflicting damage on them. A prime example is Ralof:
Before you escape Helgen, Ralof will not retaliate if you attack him.
http://www.uesp.net/wiki/Skyrim:Ralof#Notes
If they are only essential or will not attack you at a certain point, when?
Why do I ask? Because instead of asking "who is a good target on which to grind Destruction" or somesuch and getting answers mentioning just one (or few) NPCs, it'd be more useful to get a complete list.
I used the Greybeards to grind Sneak. For grinding other combat skills and offensive magic use Shadowmere, the horse can die but it will be very hard to do so. Just let it regenerate some health if it gets too low.
As far as I know these two are the only viable friendly NPCs that players can grind on.