BF2S Wiki's Short and Sweet answer:
The commander score is the sum of all commander points earned. The commander points are every point earned by a member of your team during your reign as commander divided by the total of living team members at the given time.
Kills with artillery will count towards you global kills and kills with the kit you are using but do not directly add points to your score.
After each round has finished the commander of the winning side will have his points for that round doubled.
My Commander Guide's Long, Convoluted answer:
Commanders do not earn any points from kills, kit actions, flag captures,
or anything of the sort. Rather, the Commander's TEAM earns points for the
Commander. Every point earned by anyone on the Commander's team gives the
Commander a small fraction of a point, with the denominator of that fraction
the total number of players on the team.
(Points received by soldier)
(-----------------------------) = Commander points received
( Total players on team )
Example for the lost: There are 16 players on the team. Somebody explodes an
enemy APC and gets 5 kills (10 points). Commander earns 5/8 of a point (10/16).
Only whole and complete points show up on the scoreboard.
Very suddenly, 8 people on the team decide to leave. The Commander still has
5/8 of a point. Somebody captures a neutral flag with the assistance of a
friend (3 points between them). 3/8 + 5/8 = 1, so the Commander now has one
whole point.
4 more people on the team decide to leave. Somebody makes two kills
(4 points). The Commander earns another point from that (4/4), now totaling
two Commander Points. Since it's a battlefield out there, you'll be raking in
a lot of fractions of points, and the amount of people on your team can
fluctuate wildly at any time.
A few things will make this equation seem to be inaccurate. Teamkills made by
your teammates will never decrease your points. Players who have yet to
connect to the game and with 0 points, kills, and deaths don't seem to count
toward the "total players on team".
This is slightly contrary to the popular opinion that the Commander's score
is the average of his team's. Even if the entire team leaves and is replaced,
the Commander will keep what he rightfully earned.
There are some different theories for the Commander's score, like points given
for effective use of UAV and artillery. Most of these are blatantly false. If
anyone can, in a controlled environment with video or screenshot proof, prove
MY theory wrong or offer more info, then I'll happily change it.
Points are not given retroactively if you start commanding late in a round,
but you will keep whatever combat and teamwork points you earned while a
soldier, if any.
Should you be the Commander and your team wins, the points you earned AS A
COMMANDER will be doubled. If you resign, quit, or if there is a successful
mutiny mid-round, you will keep your accumulated Commander Points, but they
will not be doubled if the round ends with you as a non-Commander.
If you personally, with a vehicle or gun, injure or kill a teammate, then you
will lose teamwork score as normal. Artillery is exempt from this, and will
not influence your score one way or the other.