

There's an explosion and the power goes out, taking Rick's monitoring equipment with it.I think he's searching for a reason to continue pursuing his evacuation to justify the risk. He begs Rick to wake up, or give him a sign.Up to this point, Shane appeared fully intent on getting Rick out of the hospital, but he's been spooked by the military (and I'm sure knowing there are Walkers about isn't helping). The environment is unsafe and patrols appear to be taking everyone out. The door opens by a soldier, and Shane ducks behind the bed.Goes to check the equipment, looking as if to find a way to take it with them.He picks Rick up, then realizes he's connected to equipment.Rushes back to the room with the gurney.Rushes to the end of the hall to get a gurney, spots military personnel holding up civilians (then shoot them).Looks around and others are rushing around.He didn't ask her what was going on, he recognized things were ramping up, and he needs to move Rick. He pulls a nurse out of the passersby and pleads with her to help him. Several people stream by and there's some yelling.

Shane hears commotion outside Rick's room and opens the door.

It actually opens with Shane emerging from Rick's room somewhat frantic, not arriving unsuspectingly for a general visit with flowers (I think this was from a different visit in an earlier episode?). Season (or Series) 1 Episode 6 opens on the scene in question. Shane knows Rick isn't dead, that's a lie he created out of what he felt was necessity. Perhaps more importantly, he takes with him a peace of mind knowing he 'did what he could' rather than outright abandoning a friend to a hopeless situation. He secures the door and puts the bed in front of it to protect him from the walkers and, perhaps, mask the room from the rapid soldier searches (maybe they won't be thorough). Shane already knows Walkers exist, though the world may not have gone completely crazy yet, he's there to get Rick. I think the question has the order of events confused, as well as the point in time when the flashback occurs.
