Cargo scanning
Cargo scanning can be done with a Cargo scanner module. This will reveal the cargo contents of the target.
Cargo scanning players
Cargo scanning is most often done on hauling ships to see if they are worth ganking.
The cargo scan result will show all items in all cargo holds lumped together (including special bays like drone bay and fleet hangar). It will also show contents of all containers.
Double wrapped contents are not shown in the cargo scan. Double wrapping is done by creating a courier contract with the items. This places them in a courier package. The courier package is then placed inside a normal container.
Blockade Runners are also immune to cargo scanning. Competent blockade runner would also be always cloaked making this bonus a bit useless.
Cargo scanning in pve
Cargo scanning works also on NPC ships and structures. It will reveal what items the target ship can drop. Presumably the NPC drops are subject to same loot fairy as player drops so each item shown on the cargo scan has 50% chance to drop.
Notable use of cargo scanning is scanning the cans in relic and data sites. Cans with no valuable items are either skipped or intentionally failed to blow them up.