PFSRD:
...it has only half of the real creature's levels or HD...
Reading this straight, I believe as far as class levels are concerned, halving each classes' levels is the best way to do this, as long as the end result can come out legal. I feel the text clearly points this direction. If the creature has racial HD, those are halved as well. (If classes and racial HD, or just multiple classes, need to be rounded, some will need to round up to maintain the correct total HD/level after the operation. My best good-faith guess is that this should be caster's choice, unless for whatever reason another player should control the choices, such as if that player is going to play as the simulacrum or use it as a cohort.)
(Personal ruling note: If I were the one ruling, I'd probably make an exception only for prestige classes that clearly extend a specific class: if you can't qualify for that prestige class after losing half your levels in the base class, then the prestige class's levels would "count" as levels in that class to be lost. The examples below will reflect this non-RAW ruling, which I personally feel is as near the intent of the rules as possible. Other options might including ignoring/waiving prestige class requirements that can't be met and simply halving all classes' levels regardless; or always dropping prestige class levels first and only retaining the PrCs if more than half the original's HD are from prestige classes [maybe they're too complicated for the illusion to duplicate]. These options are no more or less rules-as-written [RAW] than my personal ruling, but may work better at some tables.)
Be careful while calculating levels for characters with prestige classes: Keep in mind that non-numeric requirements need to be met, too. If a Paladin X/Wizard Y/Arcane Archer Z is your target, of course you're going to check for the BAB requirement, but keep an eye on those feat requirements as well!
After you're done distributing levels, rebuy skills as near half the original totals as possible, except where prestige class requirements dictate otherwise. Then rebuy feats as desired, meeting PrC requirements first and choosing only feats the original has. Don't forget to remove attributes the original gained from levels/HD the simulacrum doesn't have.
Ridiculously long example text follows:
So, this is pretty straightforward for single classed characters with no racial HD: Halve their level, round down (per the general rounding rule). For characters with more than one class, or one or more classes with racial HD, matters get complicated. Here we go!
Two even-leveled classes, neither reliant on the other: Halve the target's levels in both classes. Sorc 6/Shaman 4 becomes Sorc 3/Shaman 2. Easy.
Even class, odd class, neither reliant: Halve the levels in the even class; halve (rounding down) levels in the odd class: Hunter 3/Ranger 6 becomes Hunter 1/Ranger 3. Ok.
Two odd classes, neither reliant: Halve the levels in both classes, rounding one of them up (in order to come out with the right total number of levels), caster's choice: Rogue 9/Wizard 5 can become either Rogue 5/Wizard 2 or Rogue 4/Wizard 3. Tougher.
Two classes, one reliant upon the other (prestige class): Check first to see if the character could be still legal if the operation for non-reliant classes is followed; if so, use that (Fighter 18/Stalwart Defender 2 becomes Fighter 9/Stalwart Defender 1). If not, count the prestige class and the base class together and get as close to the normal procedure as you can: Fighter 10/Stalwart Defender 10 becomes Fighter 7/Stalwart Defender 3 (because of the Stalwart Defender's BAB +7 requirement). A GM might need to get involved to resolve a single out-of-combat spell at this point.
More than two classes, none reliant on another: This is probably a specific niche build that the simulacrum won't be able to pull off. Consider choosing a new target. If you can't or won't, halve all even classes exactly and alternate rounding odd classes down and up, starting with down. If there's a level 1 class, and you can round it up (there's another odd class), do so to keep as much of the class make up of the original as possible. Bard 6/Cleric 6/Witch 1 becomes Bard 3/Cleric 3; Bard 6/Cleric 7/Witch 1 becomes Bard 3/Cleric 3/Witch 1; Bard 7/Cleric 7/Witch 5 becomes 4/3/2 OR 3/4/2 or 3/3/3, caster's choice. This should probably have a GM helping out, just in case.
More than two classes, one or more classes rely on exactly one class each: The ideal multi-and-prestige-classed scenario. If possible, just halve them all; if not, take from the prestige class(es) until the base class(es) meet the requirements. Barbarian 10/Stalwart Defender 6/Rogue 2 becomes Barbarian 7/Stalwart Defender 1/Rogue 1. At minimum, show the end result to your GM for approval.
More than two classes, at least one class relies on at least two other classes: The probable multi-and-prestige-classed scenario. As usual with prestige classes, check to see if you can just halve them all and still qualify for the prestige classes; if so, do so. If not, check to see if the simulacrum can qualify for the prestige class with the highest requirements (if more than one) with only half its total levels and still have at least one level to put into each prestige class; if so, distribute levels to classes until all requirements are met, then distribute levels to classes as close to half the original distribution as you can get. If not, drop the prestige class with the highest requirements and repeat the last step. Fighter 4/Wizard 5/Eldritch Knight 5/Arcane Archer 6 might actually become more streamlined by using Eldritch Knight levels to help meet Arcane Archer BAB requirements: Fighter 2/Wizard 5/Eldritch Knight 2/Arcane Archer 1. I can't promise there's no better way to do that one. If the requirements for Arcane Archer couldn't be met with a level to spare, you'd just ignore it completely: Fighter 4/Wizard 5/Eldritch Knight 5/Arcane Archer 2 would become Fighter 2/Wizard 5/Eldritch Knight 1. I am certain as I can be, having not met your GM, that he or she wants to be involved in this entire process.
Racial HD plus base class levels: Halve them all following examples already given, treating the Racial HD as just another class and ensuring the total end is half the total starting rounded down.
Racial HD plus prestige class levels: If the creature can still qualify for the prestige class with half the racial HD, do it. If not, take from the prestige class(es) to restore more racial HD until they qualify (as if the racial HD were a base class used to qualify for the prestige class).
Secondary question: As far as I can tell, other than reducing saving throw DCs and the like (from raw HD loss and/or from attribute loss), simulacrums' monster special abilities should be identical to the originals', except in cases where the original monster already has a natural HD progression or a template that changes based on HD. This might lead to some "obviously unbalanced" situations (such a damaging ability that doesn't normally scale to HD being far more powerful than the simulacrum should have access to, since the damage didn't scale down) that a GM may want or need to arbitrate, so even in a rather-strictly-RAW game you should check with your GM first if you're going to be using this spell on a creature with powerful built-in abilities not granted by number of HD or class levels. The comment question about genie simulacrum: nothing indicates that efreeti gain their wish-granting power at a specific HD total, so adding or removing HD should not affect it. Obviously, a GM probably shouldn't permit an efreet simulacrum to give a PC basically unlimited wishes; but RAW certainly seems to be written that way.
So, you fought some Vampire Spawn, which have the annoying:
Energy Drain (Su): A creature hit by a vampire spawn's slam (or other natural weapon) gains one negative level. This ability only triggers once per round, regardless of the number of attacks a vampire spawn makes.
Those negative levels provided by the vampire spawn are temporary until after the duration specified and saving throw mechanics. After 24 hours, and after a failed save, they would then become permanent.
Negative levels remain until 24 hours have passed or until they are removed with a spell such as restoration. If a negative level is not removed before 24 hours have passed, the affected creature must attempt a Fortitude save (DC 10 + 1/2 the draining creature’s racial HD + the draining creature’s Cha modifier; the exact DC is given in the creature’s descriptive text). On a success, the negative level goes away with no harm to the creature. On a failure, the negative level becomes permanent. A separate saving throw is required for each negative level.
What does this mean? The character is dead. The temporary negative level remains. The negative level would have to be removed, otherwise he'd just die again.
Raising the character from the dead would have to have a restoration spell handy to remove the temporary negative levels, the same as if it were permanent negative levels.
The temporary negative levels have a 24 hour duration. That duration doesn't wipe itself off the table by character death. If that were the case, then undead with a create spawn ability would never be able to create spawn - as their energy drain attacks would simply go away when the character died.
The only rule supporting spell effects that end upon death, without special text stating otherwise, is a spell effect that require concentration. Obviously, a spell caster can't concentrate when he's dead.
What can you do?
- If the GM considers a dead1 creature, as still a creature, cast Restoration on the dead creature. There's a little bit of precedence to back that up. Raise Dead, for example, says, Target: Dead Creature. Of course, Restoration obviously doesn't have the word dead in front of Target: Creature Touched, but, ask the GM to work with you a little. The worst he can do is say no.
- If you don't have a Restoration spell handy, raise the dead character back to life, and the proceeding round cast Death Ward. That would make the character immune to the negative effects of the negative levels for the duration of the spell. That could afford you more time, especially with multiple castings of Death Ward.
- Raise him from the dead at exactly 24 hours from his death. That would give the party time to rest, have that much more preparation time (i.e. hireling services from a cleric, purchases of scrolls, pray for spells, etc.) and allow the newly raised character, with the negative levels, a quick chance at a fortitude save.
- Wait for the negative levels to expire and become permanent, and proceed to raise and restore as the rules are explicitly clearer on - probably with the assistance of higher level spell caster NPC's in a temple at the next town.
- Make a new character.
1Being dead doesn't say you become an object. It just says you are a dead character. It also doesn't say effects end when you're dead. It does say, if you are raised, you're raised in the same condition as when you died. If you have temporary negative levels when you died, and are then quickly raised, you'd still have the temporary negative levels.
Best Answer
You are right: many attributes of monsters are unaffected by negative levels.
A negative level does not affect HD-dependent abilities, even if a creature suffering a number of negative levels equal to its Hit Dice immediately dies.
As you pointed out, the SR of a dragon is not based on its class level (but only on its Challenge Rating) and is unaffected by negative levels.
However, most dragon cast spells like a Sorcerer of a level dependent upon their age category. Even if the base CL is determined by its Age, such CL is a class-specific caster level, and so it is affected to negative levels.
Similarly, the CL for its spell-like abilities (even if equal to its HD) is considered to be a "level" (by definition) and so it is affected by negative levels too.
Also remember that a negative level bears additional drawbacks (emphasis mine):