I've just started my third playthrough, and trying some pickpocketing in a solo run to improve my income. Usually i made myself invisible and steal some stuff, then put the stolen stuff in some barrel and wait to be checked. Most of the times it works, but sometimes the npc is suspicious and force me to try persuasion in order to come clean.
How does it works exactly? It depends on my attitude towards that particular npc? or it's just random?