Why do you need to take your laptop from your bag during airport security checks? Why can't they just x-ray check the whole bag together with the laptop?
X Rays don't penetrate metal. Circuit boards have a lot of metal and solder, making it easy to conceal items within. If the TSA can't see it, they get nervous. Hence the 'take out your laptop.' (Why they don't require that of iPads, I don't know.)
Now, all this being said, you can get bags that have laptop compartments. The only requirement is that they can see just the laptop and nothing else in there. This way, you don't need to take it out.
This trick, along with the "put all my electronics in my suit jacket, means that I get through the scanner as follows:
I walk through,
I'm through in like 40 seconds.
The innards of a laptop are confusing enough on their own but when you then overlay that image with the shadows cast by the accessories it turns into a confusing mess they can't understand.
Any such confusion of items will likely draw an inspection. They are just pre-empting it by saying to take the laptop out. It's also why they recommend you arrange electronics in a single layer in your carry-on--they're trying to avoid the confusion that necessitates a search through the bag.
Generally it's so that they can check the metal device that it is, and that nothing else is hidden in it. Same with SLR cameras on occasion, and I've been asked in the past to turn both of them on to prove they actually work. But generally they just want a clear and unobstructed view of all the workings, especially to see the harddisk platter. That caused some problems when SSD drives came out and they couldn't see any moving parts...
The TSA has just approved "Checkpoint Friendly" Laptop bags :
British authorities don't seem to explain much either in general, but do require that they are screened separately: