There are a few ways to do it. The most common two methods are to either stick your larger elements towards the rear or even protruding into the camera a bit (which is how the 1960s 19mm f/3.5 worked), or just not care about optical corrections and make a wider, distorted, darker image circle, which is easy to do within a small lens, and rely on opcodes to correct everything. That's what the recent 14-35mm f/4L does as well as many other lenses I mentioend above.
The Fuji 16mm f/2.8 which has been mentioned in this thread is a slightly different matter, as that lens is only projecting an image circle slightly larger than the APS-C sensor. Mechanically that lens is only as demanding as a 24mm f/4.2, so it's very easy for it to be as small as it is. Additionally Fuji rely on a lot of software corrections for it. Fuji use opcodes more than any manufacturer anyway, but the 16mm f/2.8 is hugely reliant on them even by Fuji's standards and the images it puts out are stretched and brighten to breaking point. That's why it also has the poorest reputation among users of the compact XF lenses. (And unsurprisingly the lens at the other end of that series, the 50mm f/2, is by far the best performer.)
This Canon 16mm f/2.8 is going to be trying to cover a 135 sensor, which is much more demanding than the equivalent 24mm f/4.2 the Fuji has to put out. So I fully expect this lens, if it is indeed a pancake or semi-pancake lens, to be relying on the most dramatic software corrections seen on any lens by any manufacturer to date. While putting larger elements towards the rear can help somewhat... well, go look up what Canon had to do to make the FL 19mm f/3.5 work, and how far that had to protrude into the camera. To open up another 3mm and two thirds of a stop will be a tall order, even despite the advancements made since back then, and people should not be expecting optical miracles here. Canon can't cheat the laws of physics.