There are features in the CMB, the distance and size of which can be derived from cosmological models (6-parameter Lambda CDM model). The expected size of the features can be predicted in terms of angles in the sky, depending on how curved large-scale space-time is. (The features are a statistical property of tiny temperature fluctuations in the CMB indicating the largest scale of causal connection - kind of sound waves - in the baryon-photon plasma before recombination 380,000 years after the Big Bang, called first acoustic peak of the CMB power spectrum. The angle should be about 1 degree for a flat space-time, in accordance with observation.) Things aren't quite straightforward, e.g. due to the way the universe has been expanding, therefore it's done with simulations.
Angles look larger in a positively curved space-time (e.g. a sphere) than in a flat space-time (e.g. a plane) than in a negatively curved space-time (e.g. a saddle).
The curvature of space-time follows the same principles as curvature of 2-dimensional surfaces. A triangle in an Euclidean plane has an angle sum of 180 degrees, while a triangle on a sphere has an angle sum of more than 180 degrees. Hence an object of a fixed size and a fixed distance looks larger (takes a larger angle) on a sphere than on a plane.
Here a sketch of a triangle on a sphere (may be interpreted as an observer looking to an object) and a triangle of the same size - meaning the same lengths of the sides in this case - in a plane:
(More on non-Euclidean geometry.)
If the observable universe is positively curved, it could be a fragment of the surface of a 3-sphere resp. 3+1-de Sitter space-time. A 3-sphere is finite. If the observable universe is flat (curvature 0), it could be a fragment of an infinite Euclidean space resp. 4-dimensional Minkowski space-time. That's plausible, but not the only possible extrapolation beyond the observable universe. An almost flat observable universe could e.g. be a fragment of a huge 3-spherical universe or of a huge 3-torus. Planck data don't indicate (in a significant way) that kind of structure outside the observable universe, but extrapolations become less valid the further we go beyond the observable universe.
According to the current (Lambda-CDM) model of the universe together with the best-fit parameters, the universe is flat within the limits of measurement. Hence it's plausible (by extrapolation), but not necessary, that the universe is either huge or even infinite.