Head Related Transfer Function. :) The secret is how your head, ears, and hair affect incoming sounds from different angles. It’s more than just amplitude and simple phase. Your body adds comb filtering your brain picks up on to determine vertical and horizontal angles. Very cool science.
Having said that, to get good sound staging in any dimension you must have good room treatment in that direction. So, if you want good left to right soundstage, you should have good room treatment to the sides and behind the speakers. If you want height, good treatment above the speakers.
There’s a known speaker gimmick. Dipping the frequency response around 2.4 kHz will exaggerate the sense of imaging. You’ll see this in a number of "high end" speakers.
Most of the times I've heard this effect by the way it seemed like an accident, as opposed to a real attempt by the recording engineer to do something. Intimate jazz quartets for instance.