Do monsters have to be behind objects to get a surprise round?
No. They have to be unobserved or otherwise have an surprise advantage over the characters.
http://paizo.com/prd/combat.html
When a combat starts, if you are not aware of your opponents and they are aware of you, you're surprised.
Likewise it goes on to say
The Surprise Round: If some but not all of the combatants are aware of their opponents, a surprise round happens before regular rounds begin.
In your scenario you state:
"If I have a monster on either side of the entrance, back a few squares,they [the creatures?] are unperceived until the players enter at which time the creatures would want to strike."
It seems that you mean the monsters are unperceived by the party while the adventurers are being very observable, making lots of noise and carrying a light source prior to entering the room. If the party isn't being actively observant, these conditions should grant the monsters an automatic surprise round against the party, assuming the creatures have any chance of being in a position to attack the characters when the party enters.
Perception vs. Stealth should only come into play before entering the room (e.g. somewhere along the hallway).
If the monsters are observable before the party enters the room (the adventurers hear shuffling/snorting, the creatures give off a fetid stench, magical detection, active party awareness, etc.), this could warrant a check to stay hidden.
http://www.d20pfsrd.com/skills/stealth
You are skilled at avoiding detection, allowing you to slip past foes or strike from an unseen position. This skill covers hiding and moving silently. [emphasis added]
This is where the Perception vs. Stealth check should be utilized. Unless the party is peeking around every corner with a mirror prior to entering (or has other ways of detecting the creatures), the advantage most likely goes to the prepped monsters for line of sight (thus being "unseen") -- if nothing else.
If you have a monster on either side of the door, whichever direction the first character looks will obscure the other monster. If you have a monster rushing a foe with a light, you can argue it's blinded by the light (negating surprise), but barring this, it is much easier for the creature to pinpoint the torchbearer than vice-verse. You also specified a square room, meaning that, side to side, directly left or right and closest to the door, only a length of perhaps 5' - 10' (one to two 5' squares) would be visible to the player(s) entering until both a light and head/half the full body of the first adventurer(s) were through the door.
Again, the creature(s) be should along the walls closest to the door. Standing away from the wall would likely move the creatures into a character's natural cone of vision (line of sight), negating its potential ability to hide (per illumination from a light sources).
If the creatures are clearly out of sight of the party and trying to remain out of sight until all the party members enter the room, you could use Perception vs. Stealth. However, it might be wise to ask yourself how the creatures know how many party members there are.
Your Stealth check is opposed by the Perception check of anyone who might notice you. [emphasis added]
As I am not aware of any rules stating a Perception vs. Stealth is required to enter a surprise round and it is pretty clear Stealth assumes some sort of active giveaway, Perception vs. Stealth may not even be appropriate to utilize at all.
As for who gets to act, the characters behind the player(s) entering the room would almost certainly get no actions in the surprise round.
Combatants who are unaware at the start of battle don't get to act in the surprise round.
Assuming they cannot see or sense the creature(s) in waiting (Perception vs. Stealth if appropriate), then they have essentially no chance of acting. The characters entering through the doorway should be able to act in the surprise round, assuming they are not surprised (perceived the monsters prior to room entry).
EDIT
"Should I mentally be telling myself the 2 monsters have readied a charge action on somebody coming through that door?"
Yes. Pre-planning any attack never hurts. You should be aware of any special circumstances or restrictions on your proposed tactics ahead of time. For instance, if you follow the rules as written, Charging has special restrictions during a surprise round.
http://paizo.com/prd/combat.html
Suprise
In initiative order (highest to lowest), combatants who started the battle aware of their opponents each take a standard or move action during the surprise round. [emphasis added]
Charging
Charging is a special full-round action that allows you to move up to twice your speed and attack during the action. [...] If you are able to take only a standard action on your turn, you can still charge, but you are only allowed to move up to your speed (instead of up to double your speed) and you cannot draw a weapon unless you possess the Quick Draw feat. You can't use this option unless you are restricted to taking only a standard action on your turn. [emphasis added]
Charging has other general restrictions including a minimum of 10' of movement, limiting attackers to a single melee attack (even if they are capable of multiple attacks) and having a clear path to an opponent. So it is an extremely good idea to evaluate your monsters' strategies ahead of time.
As a rule of thumb, I would feel comfortable in utilizing any attack that the creature would normally use, barring some special powers. A slime dropping on an opponent is not a special attack - it's how slimes hunt. Genuinely special attacks would not top my list of attacks to use except under exceptional circumstance. For example, a dragon, no matter how paranoid, would probably be unlikely to use a breath weapon immediately - they are almost certainly too smug about their general superiority. An exception could be made, however, if the dragon had recently been the target of another credible attack.
Regarding character awareness:
What if the player claims that their characters should not be surprised because they are in a dungeon and are expecting a monster in every room. Thus they would enter each room ready for a fight. Does this make any impact?
From a pure rules standpoint, it makes no difference whatsoever. Characters can always be surprised unless there is another rule stating that they cannot (such as from a magical item or effect). At the very least, every player has the possibility (in most cases) of failing a roll, especially if penalties are applied.
If you wish to concede that the party is always on their tiptoes and allow players a Perception check prior to entering every room with hidden opponents, this may appease some players, but not all. Inevitably, they will fail a roll at some point and be surprised.
You are correct: generally, you cannot hide behind another PC or creature and make a Stealth check.
However, lightfoot halflings can do so (they make great rogues for this reason), if the creature is one size larger than them (which includes Medium-sized PCs).
The Skulker feat (PHB, p. 170), though, does not allow hiding behind PCs. It allows hiding in "lightly obscured" areas, but no other situations (beyond the normal stealth rules). PCs provide half cover, but no obscurity, so Skulker does not apply.
Also, remember that the rogue needs to use either their action or bonus action to Hide (other characters can only use their action to do so). This means that they can't effectively use Two-Weapon Fighting and hide regularly.
Ultimately, this merely allows the rogue to get her Sneak Attack off every turn. Contrary to what you are thinking, this is not overpowered in any way. This is the rogue working as designed.
At low levels, the rogue can be quite good, especially when you factor in advantage. However, as you level up, the rogue's damage, because it always depends on the single attack, will fall off the table compared to other classes.
So, while this may seem overpowered, rogues are supposed to be able to get advantage fairly easily, and to be able to perform Sneak Attacks on pretty much every turn; this is the only way they can consistently compete for damage, especially as things level up.
Best Answer
Spiders are ambush predators, and would use the 5e hiding rules to do this
To go over your example:
Sort of. Players don't make passive perception checks, their passive perception is always on (it's a passive ability, not an active ability). If the DC to notice a hidden creature is a 12, and one of your PCs has a 13 passive perception, they will detect the hidden creature whether or not they're looking for it.
Keep in mind that perception is not only visual. While the players may not be able to see into the fog, they can hear the spider clicking around or smell it (I don't know if spiders smell bad or not). So while you are correct that they won't be able to see it, they may well be able to perceive it.
RAW, here is how you deal with the heavy fog:
This takes us to the 'Blinded' condition:
So if the spider is 100% silent and has no smell, then you could reasonably assume that a sight check is required to perceive it. In that case, yes, it would be impossible for your PCs to detect it. But, very few things in this world are completely 100% silent, so RAW there is probably a change (albeit a very small one) that the PCs could detect it with an extremely good active perception roll (assuming they had reason to make one, but thick fog in a cave sounds like a good reason to me).
The details are up to you, but you can either determine that the spider is unhearable and unperceivable and as such has 100% perfect stealth, or that it may be perceivable and is potentially vulnerable to a great perception check.
To answer your specific question about how the combat would likely play out and what the spider itself would do
Looking at the relevant rules for hiding:
So, your spider seems to fit the bill as a hide-able creature in a hide-able situation, so your spider can take the hide action, make his or her stealth check, and be hidden from the PCs until they detect it.
RAW, that makes perfect sense. Just keep in mind that if your PCs are being quiet and are more than 10 feet from the spider, then the spider needs to make an effort to detect them as well. Basically, if both groups know there is danger in the fog, then they'll both be likely trying to hide from each other until first contact is made.
Hiding has a very specific meaning in 5e. When you're hidden, it means that you have a standing stealth score than needs to be beaten by either a passive or active perception check. As long as it is not beaten, and you don't make an attack, you are hidden. Once it is beaten or you attack, you are no longer hidden. An ambush predator like a spider would likely use this to get into position around the PCs (using its blindsight to stay 10 feet away but still detect the players), and then strike when one gets separated. Once it strikes, it has attacked and loses its 'hidden' status. After the attack, it can attempt to move away from all the PCs (to once again gain the heavily obscured condition so that it can hide at will). Then, it will take its next action to hide and move away from the PCs. It will roll another stealth check and it will use that to contest the PCs active and passive perception.
Keep in mind that as long as the PCs are in the heavy fog, they will be unable to see the spider until it gets next to them. Thus, they will have disadvantage to all attacks against it, and it will have advantage on all attacks against them. Also keep in mind that fog is generally dispersed with a wind of moderate or stronger intensity, so if one of your PCs has a wind spell they should be able to disperse the fog.