You can sell illicit items at stations with a black market service available. Go to locations on your left side panel, and select a station, and it should show a smuggling icon below the description.
You can find these illicit goods by stealing it from a ship using hatch breaker limpets, (in the case of player interaction) coercion, or just damaging/blowing the ship up. Any goods that belonged to someone else are stolen and thus illegal. Damaging a ship long enough may cause it to drop cargo. If you eliminated a wanted ship, the goods are still illegal.
Another way to obtain contraband is by purchasing goods in one system and bringing them into a different system that outlaws it. The legality of goods fluctuates by system to system based on the governing faction type.
You can also find lost goods at signal sources and they are usually illicit.
Note: When smuggling contraband, keep an eye on the security rating of the system, when approaching stations, you may get scanned by a security ship. If they see what you have, you will get a large fine, you don't want that. The level of security usually determines this.