It does happen, and it is important to handle the situation properly as to not make a bad situation worse and possibly even avoid a problem all together.
I got caught in an abandoned school on Monday. It was in the middle of being demolished but I still entered the construction site and snuck into the school. I kept my eye on the bulldozer driving around outside as we walked around. There were so many holes in the walls that landscapers outside must have seen us inside taking pictures. Not too long after a police officer was standing nearby yelling in at us to come outside.
Best not to run, unless you are 100% positive you will get away. In this case, we were pretty beat no matter what so I approached the officer calmly and waved to him. I told him we were simply taking pictures. He yelled at us, said we were crazy, its so dangerous blah blah blah. He was ready to charge us with defiant trespassing and all these things, but another cop pointed out that there wasn't a single no trespassing sign on the property so they didn't have a case against us. We got off without even a ticket. If I was a dick to the cop or tried to escape, I'm sure things would've turned out differently.
But police are really the least of my worry while exploring. I worry most about wild animals and hostile homeless people. Here are a few videos of mine where I encountered people while exploring.
Let's start with a crackhead in philly. He is smoking his crackpipe at 2:23, look at the monstrous amount of smoke he blows out, crackpipe in hand. This was pure luck, the fact that we run into the friendliest crackhead in the world, but there were others down there too, and the situation could've easily turned dangerous.
Again I got lucky with this guy. He had been squatting in this house for a few months and I finally got the opportunity to invade his privacy for an interview.
Don't want to overload you with videos, but also at an abandoned amusement park we scared away some scrappers who were there stealing a few items. As soon as they saw us they packed up the trucks and left in a hurry.
Also while in the abandoned AC electric control center a truck came flying down the loading dock ramp and someone violently tried shaking open the door. We happened to be standing on the other side of the door at the time, frozen in fear by the loud banging sound. Luckily he didn't get it open and we had time to leave without running into them.
At a abandoned luxury hotel resort there was a guy outside cutting up pieces of metal and loading them into his truck. We checked out one of the buildings without being seen, though he prevented us from checking out a very cool indoor pool! Bastard!
And I just posted this video a few hours ago. Had a shady encounter towards the end of the video.
Anyway.... what are your stories? Who have you run into while exploring? What are your strategies for dealing with these situations?