Does the connected sum depend on direction of gluing? The connected sum of two surfaces (2-manifolds) is defined by removing a disk from each and gluing the cut edges:

(Image adapted from Wikipedia)
Does the resultant surface (up to homeomorphism) depend on the direction of gluing, as indicated by the red arrows? If one of the arrows were reversed, one of the surfaces would have to be "flipped around" to do the gluing. However, the new resultant surface seems to be homeomorphic to the one shown in the picture. Is there a difference?
I'm slightly confused by all the talk about oriented manifolds and how orientability affects the well-definedness of the connected sum... but I don't understand topology at that high a level.
 A: In general, two connected manifolds can have at most two different connected sums up to homeomorphism. The two possibilities are determined by whether the gluing map preserves or reverses orientation of the sphere (the circle, in the case you've drawn). But sometimes the two possibilities yield homeomorphic manifolds.  More specifically,

*

*If either $M$ or $N$ is nonorientable, then $M\# N$ is unique up to homeomorphism.

*If $M$ and $N$ are both orientable and either one has an orientation-reversing self-homeomorphism, then $M\#N$ is unique up to homeomorphism.

*If $M$ and $N$ are both orientable and neither of them has an orientation-reversing self-homeomorphism, then there are at most two different connected sums up to homeomorphism.

In the case of surfaces, every orientable surface has an orientation-reversing self-homeomorphism, so connected sums of surfaces are unique.  (For a compact surface of genus $g$, you can visualize such a homeomorphism by reflecting through a plane that passes through the centers of all of the "doughnut holes.")
The simplest example of a manifold with no orientation-reversing self-homeomorphism is probably $\mathbb C\mathbb P^2$, so you can get two topologically distinct manifolds by taking a connected sum of $\mathbb C\mathbb P^2$ with itself. These are often denoted by $\mathbb C\mathbb P^2\# \mathbb C\mathbb P^2$ and
$\mathbb C\mathbb P^2\# \overline{\mathbb C\mathbb P^2}$.
Much of this is explained (with references) at http://www.map.mpim-bonn.mpg.de/Connected_sum.
ADDED 6/22/21: In the case of my third bullet point above, I originally wrote incorrectly that there are two different connected sums up to homeomorphism. But Michael Albanese questioned whether that must always be the case, so I poked around a bit and learned that there are apparently examples of compact oriented manifolds $M$ and $N$ with no orientation-reversing diffeomorphisms such that $M\#N$ is homeomoprhic to $M\#\overline{N}$. See Jason DeVito's comments following this MSE answer.
