What conditions on an isometric self-map guarantee surjectivity? Let $M$ be a metric space and let $T:M\rightarrow M$ be a distance-preserving map. $T$ is obviously injective. Under some circumstances, it is also necessarily surjective (examples below). I am wondering if there is a good general characterization (in terms of $M$) of when this is the case.

Under what general conditions on $M$ is $T$ necessarily surjective?

Ideally, I would like a general guideline that can be used to settle the question for "naturally-occurring" classes of $M$, but I don't feel confident this exists, so as a baseline I would like to know (1) if $M$ a compact metric space does it imply $T$ surjective? and (2) if $M$ is a connected Riemannian manifold without boundary does that imply $T$ is surjective?
Some examples of when $T$ is necessarily surjective:


*

*$M$ is a Euclidean space of (finite) dimension $n$. In this case, any isometry $T$ is an element of $O(n)$ composed with a translation. As both translations and orthogonal linear transformations are surjective, so is $T$.

*$M$ is a compact Riemannian manifold. Then $M$ has finite volume, and $T$ preserves the volume, so $M\setminus T(M)$ has zero volume. Meanwhile $T(M)$ is compact since $M$ is, and thus closed (since $M$ is hausdorff), so $M\setminus T(M)$ is open, and the only open subset of $M$ with zero volume is the empty set. Thus $T$ is surjective.
[These examples are both essentially about finiteness conditions on $M$ that bring injectivity and surjectivity into coincidence. In the first case, isometries are linear up to a translation, and linear self-maps of finite-dimensional vector spaces are surjective iff they're injective. In the second case, the finiteness condition is compactness.]
Examples when $T$ isn't surjective:


*

*Let $M = \ell^2(\mathbb{R})$, the square-summable sequences of real numbers, which is a Hilbert space. The right-shift operator $(a_1,a_2,\dots)\mapsto (0,a_1,\dots)$ is an isometry but is not surjective.

*With a similar idea (but not requiring an infinite-dimensional space), let $M$ be the disjoint union of an $\mathbb{N}$-indexed family of isometrically isomorphic subspaces $M_1,M_2,\dots$. Then let $T$ map $M_1$ isometrically to $M_2$, $M_2$ to $M_3$, etc. Then the image does not contain $M_1$. This shows that $M$ can be a manifold.

*Another similar idea: let $M$ be upper half-space $\mathbb{R}^n\times \mathbb{R}_{\geq 0}$, and let $T$ map $(a_1,\dots,a_{n+1})$ to $(a_1,\dots,a_n,a_{n+1}+1)$. This shows that $M$ can be a connected manifold with boundary.
 A: *

*Every isometric self-map of a compact metric space is automatically surjective. This was asked (and answered) many times earlier, for instance, here (which was already closed as a duplicate, because it was answered here). 

*If $M$ is merely a connected Riemannian manifold without boundary, you essentially gave your own counter-example. For instance, $M=(0,\infty)$ with the standard metric admits a non-surjective isometric self-map $x\mapsto x+1$. 

*However, if you assume, in addition, that $M$ is a complete (connected) Riemannian manifold (without boundary) then every isometric (in the sense of metric geometry) self-map $f: M\to M$ is surjective. Suppose not. Then $N=f(M)$ is open in $M$ (by the inverse mapping theorem) and, by the connectivity assumption, has nonempty frontier $Fr(N)$ in $M$. Let $y_i=f(x_i)\in N$ be a sequence converging to a point $y\in Fr(N)$ and $y\notin N$. Then $(y_i)$ is a Cauchy sequence in $M$. Since
$$
d(x_i, x_j)= d(y_i, y_j), \forall i, j,
$$
the sequence $(x_i)$ is Cauchy as well. By the completeness assumption, $(x_i)$ converges to some $x\in M$. By continuity of $f$, $f(x)=y$. A contradiction. 
Regarding the question,

Under what general conditions on $M$ is $T$ necessarily surjective?

I find it too vague for my taste. At best, I think, you can get a list of examples and non-examples. 
