It depends on how it looks on the monitor. If it is in a bag with a bunch of stuff, so they can't get a clear look, then it has to come out.
There are bags now that allow the laptop to be layed flat without overlapping the rest of the bag. No removal required.
You can go to the TSA site for the current rules, but any agent can rescreen (removed from your bag) anything they feel need to rescan.
International, it varies. Charles d Gaulle seems to want ALL electronic devices removed, including cables.