If we have a triangulation of a manifold $M$ of dimension $i$ and we have simplicial homology $H_i(M)=\mathbb{Z}$, what is the condition than there exists an embedded sphere $S^i$ that generates the homology group? We could also have that $H_i(M)$ is of higher rank, when do there exists spheres that generate a $\mathbb{Z}$ factor? Does this question even make sense and can the answer be simpler in case when $M$ is of low dimension, 2 or 3, or $i$ is low, 1 or 2?

$\begingroup$ Did you intend for $i$ to be the dimension of $M$ and the degree of the homology group? $\endgroup$ – Michael Albanese Feb 16 '18 at 23:41
(I'm assuming that the dimension $\dim(M)$ should have been different than the dimension of the homology classotherwise this can only happen if $M$ is the disjoint union of $S^i$ with some other manifold.)
This is a very classical question. Here are some things you can say about it:
In order for this to be possible, your element in $w \in H_i(M)$ needs to be in the image of the Hurewicz map $$\pi_i(M) \to H_i(M).$$ This is simply not always possible. For example, there is an exact sequence involving group homology: $$ \pi_2(M) \to H_2(M) \to H_2(\pi_1(M); \Bbb Z) \to 0 $$ This means that the image of $w$ in $H_2(\pi_1(M); \Bbb Z)$ needs to be zero.
If $M$ has no homotopy groups below degree $i$, $w$ is always in the Hurewicz image: this is the Hurewicz theorem.
One necessary condition on your homology class is that it must be primitive: the diagonal $\Delta: X \to X \times X$ takes $w$ to $i_*(w) + j(w)$, where $i$ and $j$ are inclusions $X \to X \times X$ as horizontal and vertical slices.
After finding whether your homology class comes from homotopy, you need to check whether it comes from an embedding. If $i < \dim(M)/2$, I believe that this is always possible by a variant of the Whitney embedding theorem (you perturb your map to be a smooth embedding).
It gets very difficult and situational if $i \geq \dim(M)/2$. For 3dimensional manifolds, the sphere theorem allows one to find nonzero elements of $\pi_2(M)$ coming from embedded spheres, but this is a tough theorem.

$\begingroup$ Do you have a reference for the $i < \dim(M)/2$ case? $\endgroup$ – Michael Albanese Feb 17 '18 at 14:48

$\begingroup$ @MichaelAlbanese I don't know one offhand. But I believe that this is completely covered by the reference that you give in your answer: if $s < m/2$ and $M$ is pathconnected, then $2s  m + 1 \leq 0$ and $2m \geq 3s+3$ (this latter having to be checked manually for $m < 6$). $\endgroup$ – Tyler Lawson Feb 17 '18 at 15:08

1$\begingroup$ Thanks, I should have thought of this. If $s < m/2$, then the condition $2m \geq 3s + 3$ holds provided $s \geq 1$ (in particular, you don't need to check manually for $m < 6$). Note that $s < m/2 \Leftrightarrow 2s < m \Leftrightarrow 2s + 1 \leq m$ so $2m \geq 4s + 2 = 3s + (s + 2) \geq 3s + 3$ if $s \geq 1$. $\endgroup$ – Michael Albanese Feb 17 '18 at 15:32

$\begingroup$ @TylerLawson: What do you mean by "primitive" in the third bullet point? $\endgroup$ – Marco Golla Feb 19 '18 at 13:05

$\begingroup$ @MarcoGolla That's what I was trying to write immediately after. Basically this asks that $\Delta_*(w) = w \otimes 1 + 1 \otimes w$ in $H_*(X) \otimes H_*(X) \subset H_*(X \times X)$. $\endgroup$ – Tyler Lawson Feb 19 '18 at 16:37
As mentioned in Tyler Lawson's answer, the homology class $w \in H_i(M)$ in question needs to be in the image of the Hurewicz map so that there is at least a continuous map $f : S^i \to M$ with $f_*[S^i] = w$. But when is $f$ homotopic to an embedding $g$? Note, requiring $g$ to be homotopic to $f$ ensures that $g_*[S^i] = f_*[S^i] = w$.
I found the following theorem of Haefliger in An Introduction to Contact Topology by Geiges, namely Theorem $8.2.6$ (i).
Theorem: Let $V$ be a closed, connected manifold of dimension $s$ and $M$ a manifold of dimension $m$. Let $f : V \to M$ be a (continuous) map such that the induced homomorphism $f_{\#} : \pi_j(V) \to \pi_j(W)$ is an isomorphism for $j \leq k$ and surjective for $j = k + 1$. Then $f$ is homotopic to an embedding if $m \geq 2s − k$ and $s > 2k + 2$ (equivalently, $m \geq 2s − k$ and $2m \geq 3s + 3$).
The reference given is: A. Haefliger, Plongements différentiables de variétés dans variétés, Comment. Math. Helv. 36 (1961), 4782.
When $V = S^s$, we obtain the following corollary (Corollary $8.2.7$ (i)).
Corollary: Let $M$ be an $m$–dimensional manifold. If $2m \geq 3s + 3$ and $M$ is $(2s − m + 1)$connected, then any map $S^s \to M$ is homotopic to an embedding.
For example, when $m = 5$ and $s = 2$, we see that $w \in H_2(M)$ can be represented by an embedding if and only if it can be represented by a continuous map $S^2 \to M$. If $M$ is simply connected, this is always the case by the Hurewicz theorem.
Here is a quite instructive example.
If $\iota:\mathbb{S}^1\to\mathbb{S}^5$ is an embedding, then it follows from the Alexander duality that $H_3(\mathbb{S}^5\setminus \mathbb{S}^1)=\mathbb{Z}$. The homology of $\mathbb{S}^5\setminus \mathbb{S}^1$ does not depend on the embedding. If $\iota$ is a smooth embedding, then a generator of $H_3(\mathbb{S}^5\setminus \mathbb{S}^1)=\mathbb{Z}$ is given by a smooth embedding of $\mathbb{S}^3$, namely by a $3$sphere that is linked with $\iota(\mathbb{S}^1)$ with the linking number $1$.
However, one may find a toplological (highly nonsmooth) embedding $\iota:\mathbb{S}^1\to\mathbb{S}^5$ such that $H_3(\mathbb{S}^5\setminus \mathbb{S}^1)=\mathbb{Z}$ is not generated by an embedding of $\mathbb{S}^3$, because $\pi_3(\mathbb{S}^3\setminus\iota(\mathbb{S}^1))=0$.
For a construction of such an embedding, see https://mathoverflow.net/a/316175/121665 and a comment by Ian Agol.