In wikipedia there is a proof for 3-manifolds that I don't understand. It says that if $M$ is an irreducible manifold and we express $M=N_1\sharp N_2$, then $M$ is obtained by removing a ball each from $N_1$ and $N_2$ and then gluing the resulting spheres together. These united spheres form a 2-sphere in $M$, and the fact that $M$ is irreducible means that this sphere must bound a ball. Undoing the gluing operation (how?), either $N_1$ ir $N_2$ is obtained by gluing that ball to the previously removed ball on their borders.
I understand until here. Now, it says: This operation though simply gives a 3-sphere. That means that one of the two factors was in fact a trivial 3-sphere.
But why gluing a 2-sphere to one of the factors gives a 3-sphere? I can't understand this part.
Thanks for the help!
This is not about "gluing a 2-sphere to one of the two factors". Instead its about reconstructing one of the two factors $N_1$ or $N_2$ by gluing two 3-balls together. Here's a bit more detail.
Suppose that $B \subset M$ is the 3-ball bounded by the "united sphere".
Also, for $k \in \{1,2\}$ let $B_k \subset N_k$ be the 3-ball that was removed from $N_k$.
As you say, from irreducibility of $M$ it follows that for either $k=1$ or $k=2$, the manifold $N_k$ is obtained, or is reconstructed, by gluing $B$ and $B_k$. That gluing identifies the 2-sphere boundary of $B$ and the 2-sphere boundary of $B_k$. Any manifold that is obtained by gluing two 3-balls, identifying their 2-sphere boundaries, is homeomorphic to $S^3$.