In the U.S., the TSA put out guidance that iPads don't need to be removed from carry-ons, but it still allows individual airports and inspectors discretion. I don't remove mine, but travel often and have been asked to remove an iPad two or three times.
Sometimes they appear to want to do a spot check; sometimes travelers have stuff packed so that it's hard to tell on X-ray what you've got, like when there are layers of electronics on top of each other. (Like traveling with a couple of iPads laid against each other, which I've done.)
In other countries where I don't know the policy, I just ask before I remove anything.