Once you have a Radio Station up and running, you can attract new people to your shelter. Unfortunately, you can also attract unwanted attention. Raiders and monsters will sometimes attack your shelter and if left unchecked can run through your shelter, knocking out your Champions and Workers, and stealing resources. To counter this you can build defenses.
When your guards notice an invasion approaching, you will get a notification. You have about a minute before the invasion arrives. At this point Andrea will pop up and ask you if you want to skip the wait and take on the invasion immediately.
During this stage, you can move characters around, if you don't already have your defenses manned. However, apart from moving characters and managing their equipment, most other game functions are locked. When the invasion is about 15 seconds away, the notification changes to a countdown.
And then a notice that the invasion is occurring.
You can still move characters around your base at this time - important to remember if the invaders get inside and reach an empty section of your base with no one to attack them. When all the invaders have been defeated, you will get a summary of the results.
There are some Shelter Level tasks and event tasks that require surviving invasions, so there may be times you actual want to cause invasions.
Some invasions are triggered as part of the Campaign Story - you can't avoid these, but they also only happen once. Replaying a mission that triggered an invasion the first time will not result in any future invasions. Apart from those story invasions, invasions can be triggered a few ways.
If you want invaders, make sure they know where to find you!
Most Important: Your Radio Station must have characters working in it to trigger invasions outside of the Campaign Story.
You can check the Radio Station to see your shelter's current Threat Level. The Threat Level builds up from Peaceful to Dangerous while your radio is active. The higher your threat level becomes the more likely you are to get an invasion. Its possible - but not known for certain - that you can only get invasions when the threat level is maxed out.
It takes 4 hours to go from Peaceful to Dangerous after an Invasion ends.
If your threat level is Dangerous, but you haven't gotten an Invasion yet, there's a couple things you can do to help speed things up.
Collect rewards from the Radio Station - if you have 5 rewards to collect and are at a Dangerous threat level, collecting the rewards is nearly 100% guarantee for an invasion.
Restart the game - you'll usually get an invasion within a few minutes of restarting, as long as your threat level is Dangerous.
Make sure your Champions and Workers are always armed. Invaders make short work of anyone without a weapon, and they can be annoying to track down and defeat once they get loose in your base if most rooms don't have armed characters to defend them.
Keep someone in the Gate, and ideally assign someone to whatever room is just past the Gate as well. If your outer defenses weaken the attack enough, the characters waiting just inside should keep the invaders from reaching the elevators. Even if that second room isn't one you normally assign characters to, you can drag and drop them to assign them to the room just for defense. I usually keep my Expedition Center just inside my Gate, and I keep Samantha assigned to that room as a last line of defense.
For your outer defenses, make sure at least your Balcony has guards with high DPS assigned to it. If you can build one or two Guard Towers and keep them manned, even better. You can play around with what combination of defenses work best for you. But my favorite is Spikes → Barricade → 2x Guard Towers → Gate. With the guards in the Balcony and Towers, most invaders don't even breach my Barricade anymore.