Among the many mysteries of the universe there is one that is deceptively simple and yet strikes at the very heart of our ignorance of the cosmos: what is the shape of the universe? To come to the correct answer, we need to solve the mysteries of dark matter and dark energy and some other pretty crucial problems — and we don’t have the tools to do that just yet.
So, for now, we have the best guess: The universe, as far as we can tell, is 3-dimensionally flat. Now, this doesn’t mean we live in Flatlandia or that somehow the Earth is flat (it really isn’t). It’s about the geometry of the universe, and the flat universe has a very simple geometry, something you might have encountered in math lessons in school: two parallel lines in this universe will never meet, and the sum of the interior angles of a triangle is always 180 degrees.
The geometry of the universe is estimated from the properties of the various components: electromagnetic radiation, regular matter, dark matter, and dark energy. If the sum of all the densities of these matches a precise number, called the "critical density", the universe is flat. A value lower or higher produces very different geometries, as you can see below.
If the density of the universe is less than the critical density then the shape of the universe is akin to a saddle or a pringle (if the universe was 2-dimensional). In that universe, two parallel lines not only never meet but grow further and further apart. This is known as an "open universe".
On the other side of the critical density, there is the "closed universe". The universe in this case has a geometry that has a 2D equivalent to the surface of a sphere. This doesn’t mean that the universe is a big ball, these are just ways for us to understand the complexity of 4-dimensional geometry using something we are familiar with.
In a closed universe, parallel lines meet twice. This might seem completely wrong, but it is easy to picture it. Just imagine the meridians, the lines that provide the longitude of a location on Earth. These lines are all parallel to each other at the equator. But they will converge at the North and South Pole.
So where does our best guess come from? Observations of the components of the universe tell us that it is really very close to the critical density, so very close to being flat, with the uncertainty being in the closed cosmos territory. While the geometry is simple(r), there are a lot of physical problems to solve this
First of all, we still don’t know exactly what dark matter and dark energy are, which may affect the geometry of the universe. Even if we ignore that, there are more issues to solve. For the universe to have a density very close to the critical density today, it means that it had to be exactly the critical density during the Big Bang. However, there is no reason for this to be the case.
There are scenarios that solve this and other problems, such as cosmic inflation but they are yet to be experimentally confirmed. The size of the universe, if it’s infinite or not, depends on the shape of the universe (among other factors). But that, as they say, it’s another story.