* Firstly: There must be water-soluble salts present somewhere in the wall.
* Secondly: There must be sufficient moisture in the wall to render the salts into a soluble solution.
* Thirdly: There must be a path for the soluble salts to migrate through to the surface where the moisture can evaporate, thus depositing the salts which then crystallize and cause efflorescence.
All three conditions must exist.
You could compare it to sweating; when you sweat your body is pushing salts to the surface of your skin leaving the salt on your skin. Similar to masonry.