Rank of coherent sheaf on complex manifolds Let $X$ be a complex smooth connected manifold of dimension $n$ and let $\mathcal{O}_{X,x}$ be the ring of germs of holomorphic functions at $x$. Since the stalk of $\mathcal{O}_X$ at $x$ does not depend in which open subset is contained the point, then it can be identified with the ring of convergent power series in $n$ variables. Let $K(x)$ be the field of fractions of $\mathcal{O}_{X,x}$, i.e. it is the field of germs of meromorphic functions at $x$.
Definition: Let $\mathcal{F}$ be a sheaf over $X$, then we say that $\mathcal{F}$ is coherent if for each $x\in X$ there exist a neighborhood $U$ of $x$ and an exact sequence \begin{equation*}\mathcal{O}_U^{\oplus q}\rightarrow\mathcal{O}_U^{\oplus p}\rightarrow\mathcal{F}_{|U}\rightarrow 0\end{equation*}for some $p,q>0$ where $\mathcal{O}_U$ is the restriction to $U$ of the sheaf of holomorphic functions on $X$. In particular the sheaf $\mathcal{F}$ is locally finitely presented.
Definition: Let $\mathcal{F}$ be a coherent sheaf on $X$, since the stalk $\mathcal{F}_x$ is a finitely-generated $\mathcal{O}_{X,x}$-module then we can define the rank of $\mathcal{F}$ to be \begin{equation*}\text{Rank}(\mathcal{F}):=\text{dim}_{K(x)}\bigg(\mathcal{F}_x\bigotimes_{\mathcal{O}_{X,x}}K(x)\bigg)
\end{equation*}
Question 1

Since $X$ is assumed to be smooth and connected, is the rank of a
coherent sheaf $\mathcal{F}$ constant and equal to $r$ say?

Now suppose that $\mathcal{F}$ is coherent and torsion-free (i.e. $\mathcal{F}_x$ is a torsion-free $\mathcal{O}_{X,x}$-module for each $x\in X$), then it can be proved that there exist a closed complex manifold $Y\subset X$ of codimension at least $2$ sucht that $\mathcal{F}|_{X\setminus Y}$ is locally-free and in particular has finite constant rank (since over this open subset is a holomorphic vector bundle, am I right?).
Question 2

Adding the hypothesis of being torsion-free, what can we say about the rank over $Y$? Could it jump?

 A: To your first question: No, you can not in general assume that the rank of a coherent sheaf on a connected manifold is constant. In fact, vector bundles on connected manifolds are precisely the coherent sheaves with constant rank.
A little more involved example would be the cokernel sheaf of the following morphism. Let $B\subset \mathbb{C}^n$ be the unit ball and let $\phi\colon \mathcal{O}_B \to \mathcal{O}_B^n$ be given by $f\mapsto \left(z_1f,...,z_nf\right)$. The cokernel is coherent but not a vector bundle, since the cokernel is not free at $0$.
Explicitly, if it were a vector bundle then $\text{coker}\left(\phi\right)\cong \mathcal{O}_B^{n-1}$, since every holomorphic bundle over $B$ is trivial. And then the sequence
$0 \to \mathcal{O}_B \to \mathcal{O}_B^{n} \to \mathcal{O}_B^{n-1} \to 0$
would be spilt exact, meaning there would exist $g \colon \mathcal{O}_B^{n} \to \mathcal{O}_B$ such that $g\circ f = \text{id}$, which is clearly not possible.
To your second question: Even if your sheaf is torsion-free, the rank can still jump. One difference is that the singular set of a coherent sheaf has codimension at least $1$ and the singular set of a torsion-free coherent sheaf has codimension at least $2$. So for example, a torsion-free coherent sheaf on a connected complex $1$-dimensional manifold is locally free and thus has constant rank.
In general the rank of a coherent sheaf $F$ is upper-semicontinuous, i.e. for every $p\in M$ there exists an open subset $U$ such that $\forall q \in U \colon \text{rank}_q\left(F\right)\leq \text{rank}_p\left(F\right)$.
Edit: I realized your second question was not addressed by my answer, since you asked about the rank of torsion-free sheaf over its singular set. For this note that pullback preserves coherence and fiber rank is invariant under pullback. Hence again one can at most expect there to be a codimension $1$ subset in $Y$ such that $i^*_YF$ has constant rank away from this set. Here $i_Y$ denotes the inclusion of $Y$ in $M$.
A: Question: "Now suppose that $F$ is coherent and torsion-free (i.e. $F_x$ is a torsion-free $O_{X,x}$-module for each $x∈X$), then it can be proved that there exist a closed complex manifold $Y⊂X$ of codimension at least 2 sucht that $F|X∖Y$ is locally-free and in particular has finite constant rank (since over this open subset is a holomorphic vector bundle, am I right?)."
Answer: If $X^a\subseteq \mathbb{P}^n_{\mathbb{C}}$ is a complex projective manifold and $E^a$ is a coherent $\mathcal{O}_{X^a}$-module, it follows $X^a:=X$ is algebraic and to $E^a$ corresponds a coherent $\mathcal{O}_X$-module $E$ with the property that there is an open sub variety $U\subseteq X$ where the restriction $E_U$ is a locally trivial $\mathcal{O}_U$-module of finite rank $e$. This implies the same result for $E^a$ I believe: The $\mathcal{O}_{X^a}$-module $E^a$ when restricted to $U$ is locally trivial of finite rank $e$. I believe the functor $F$ (and its "inverse" $G$) that associates the coherent $\mathcal{O}_X$-module $E$ to the $\mathcal{O}_{X^a}$-module $E^a$ respects restrictions and isomorphisms. Hence when $E_U \cong \mathcal{O}_U^e$ it follows
$$E^a_U \cong G(E_U) \cong G(\mathcal{O}_U^e)\cong \mathcal{O}_{U^a}^e.$$
You must check the original GeoAlg-paper where this correspondence is proved to exist.
There is the "generic freeness" result in Matsumura (page 185, $24):
Theorem 1. Let $A$ be any noetherian ring and let $M$ be a fintely generated $A$-module.  It follows there is an element  $a\in A$ such that $M_a$ is a free $A_a$-module of finite rank.
Corollary. Let $Y \subseteq \mathbb{P}^n_{\mathbb{C}}$ be any projective sub scheme/variety and let $\mathcal{E}$ be a coherent $\mathcal{O}_Y$-module. It follows there is an open set $U \subseteq Y$ with $\mathcal{E}_U$ a locally trivial $\mathcal{O}_U$-module of finite rank.
Proof. Choose any open affine subset $U:=Spec(A) \subseteq Y$ and let $\mathcal{E}(U):=E$. It follows from Theorem 1 there is an open subset $D(a) \subseteq U$ where $E_a \cong \mathcal{E}(D(a))$ is a finite rank trivial $\mathcal{O}_{D(a)}$-module. Hence there is an open subscheme $D(a) \subseteq U \subseteq Y$ where $\mathcal{E}_U$ is locally trivial of finite rank. QED.
Hence it seems the result holds in greater generality if your complex manifold/space is projective.
