I am not satisfied with the given answers. Most claims about the advatages of pkexec are completely ridiculous and so far i tend to agree with Kevin Chadwick.
I am going to show in this post, that most of the claimed advantages for pkexec are also implemented in sudo (some however are not).
Lets be about it:
The environment that PROGRAM will run it, will be set to a minimal known and safe environment in order to avoid injecting code through LD_LIBRARY_PATH or similar mechanisms.
Answer: So does sudo. With sudo you can set per user and per program policies about wether to retain or reset the callers environment in the context of sudo. The env_reset policy is set by default.
You can't run graphical applications via pkexec without explicitly configuring it to do so.
Answer: Because this is merely a result of the environment reset this is obviously true for sudo as well. Note however thet neither pkexec nor sudo can prevent a malevolent application running as root to retrieve all neccessary information from the display managers or the users X11-cookie file. The latter, both or similiar, may even be done by non root applications depending on circumstances.
simply write an action definition file like this ...
Answer: "simply" ... dude, srsly?
Anybody can run "Run as" a superuser (provided they can authenticate as such), with sudo you have to be listed in the sudoers file as admin.
Answer: Plain wrong. Sudo does not require explicit listings of users. Listing any user group or even setting a permission for all users in general can be done. The target_pw directive allows those users to authenticate with the credentials of the user in whoose context they want to run an application, i.e. root. Apart from that the equally traditional su (su / gtksu / kdesu) program can be used to do the very same without special configuration.
The so-called 'policies` of PolicyKit can be used to set more advances settings. For example, whether the password should be remembered.
Answer: Again sudo, too, allows the user to remain authenticated for a specified time. The option is named timeout, configurable globally, per user, or per application. Authentication can be retained per tty or globally per user.
Note that pkexec does no validation of the ARGUMENTS passed to PROGRAM.
Answer: Sudo does btw. Just saying. (Admitted, you can easily mess up with this, and it is normally not done).
But here comes the part, that I find interesting about PK:
You can tweak a little how you want programs to be run via pkexec: icon, text to display, [...]
Answer: Yeah, you can even have localization stuff and all that. Depending on circumstances this can be nifty indeed. Sad though, that someone felt the need to reinvent the wheel for this feature. This would probably be something to put into the graphical gtksudo/kdesu wrappers.
By granting it specific permissions only with a special policy. For example, the software centre uses PolicyKit to install/remove software, and when you grant it permission, it can use that permissions to install or remove software, and nothing else than that [...]
Answer: Now, this would be very, very interesting. Only I have trouble believing, that this is actually the case. I have no idea what OS mechanism could be used for that in Linux. Is pk doing something with pgroups here? But how can this affect software installation?
I think pk might be depending on a certain cooperation with the application for that. In this case this is not really a feature of policykit but of the app you run with it. Policykit is only a centralized configuration framework then. Unfortunately not a pretty one. PKs XML-Files are way more complicated than anything an app could provide natively short of binary files. And no one would be so looney to use binary ... oh gconf ... never mind.
Or did you mean instead: The software center itself runs in plain user context, and performs installation/removal via pkexec helper programs? Most obviously it could do that with sudo as well.
I would like to restate the original question: What are the advantages of pkexec over sudo?