When you hard cook an egg, this air heats up, expands, and escapes through pores in the shell—but not before the egg white sets. This leaves the egg with a flattened end. Pricking the egg provides a quick escape route for the air, which gives you an egg with a smoothly rounded end.