We can answer this with Cech cohomology. There is a theorem known as Alexander duality, stated in full generality as follows:
Let $A$ be a compact subset of $S^n$. Then $\check {H}^{n-q-1}(A;\Bbb Z) \cong H_q(S^n - A; \Bbb Z)$. (I think Bredon proves this in his book "Geometry and Topology".) All groups here are understood to be reduced.
Your question is: let $A$ be compact. Is "number of path components of $S^n-A$" independent of the embedding into $S^n$? And the answer to this is yes: $H_0(S^n - A)$ is precisely $\Bbb Z^{a-1}$, where $a$ is the number of path components of $S^n - A$. So we see that the number of path-components of $S^n - A$ is one more than the rank of $\check H^{n-q-1}(A;\Bbb Z)$, which is a homeomorphism invariant.
Lastly, note that $S^n - A$ is an open subset of $\Bbb R^n$, and hence path-components are the same as connected components, because it's locally path-connected.
It is going to be very difficult in general to calculate the Cech cohomology of $A$. If your compact set $A$ is locally contractible, then this is the standard singular cohomology, which is much easier to compute.