When you arrive in systems that have security, you will be automatically scanned. If you are carrying contraband in your personal inventory or non-shielded cargo module, it will always be detected by a contraband scan.
Shielded Cargo Modules
If you have a Shielded Cargo module installed, contraband in your ship's cargo hold may be protected by its Shielded Cargo capacity. You can view your ship's Shielded Cargo capacity by navigating to the Ship Overview in the Ship menu.
The closer your contraband weight is to your ship's Shielded Cargo capacity, the more likely it is to be detected by a contraband scan.
A Scan Jammer will also help.
Shielded Cargo holds and Scan Jammers will be scarce at vendors, but you may find ships with one or both already installed. If you still find yourself in need of further concealment, the Payloads skill will make guard ships less likely to detect contraband.
Where to Sell Stolen Items
Stolen items and Contraband items can be sold to specialized vendors that accept these goods. One of the first vendors you may encounter is in Neon City, in the Trade Authority Building, named Kolman Lang.
Stolen items are different than Contraband in that you won't be stopped by the Guards and it won't be found when you are scanned.
What Happens When You Get Arrested?
Getting arrested with contraband or stolen items will incur a penalty from the authorities if they are in your inventory or ship cargo hold. If you get caught with these items you will have the following options available to you:
You can pay your bounty, which will result in the loss of the contraband or stolen items along with Credits.
Fight/Escape: You can attempt to flee or fight your way out of an arrest. This may incur a severe bounty for the arresting faction.