What space is the set of $k$-points $X(k)$ in general? Let $X$ be a scheme, we may suppose of finite type over $k.$
Take $x\in |X|$ a point of the underlying topological space. The projection $\mathcal{O}_{x}\to \mathcal{O}_x/m_x=k(x)$ induces a closed immersion $\operatorname{Spec} k(x)\to \operatorname{Spec} \mathcal{O}_x;$ then we have by composition a morphism:
$$\phi_x:\operatorname{Spec} k(x)\to \operatorname{Spec} \mathcal{O}_x \to X$$
$$* \longmapsto m_x \longmapsto x$$
On the other hand there calling $X(k)=\text{Hom}(\operatorname{Spec} (k),X)$ there is an obvious function $r:X(k) \to X: \phi \mapsto \phi(*)$
I read that when $k$ is algebraically closed we have that $X(k)$ is the set of closed points of $X$ and inherits the subspace topology.

What about the case when $k$ is not algebraically closed? What is the natural topology to put on $X(k)?$
When $k$ is algebraically closed do we have a homeomorphism $|X| \simeq X(k)?$
What can we say about the functor $$\text{Sch}_k \to \text{Top}$$
$$X \longmapsto X(k)$$
In what way is it "better" than the forgetful functor $X \mapsto |X|$ ? Are there cases where the two coincide? In other words, what is the relationship between $|X|$ and $X(k)$?

The example I am mostly interested in understanding is the following.

I read that if $X$ is a smooth scheme of finite type over $\mathbb{R},$ then the topology on $X(\mathbb{R})$ inherited from $X$ is the euclidean one and $X(\mathbb{R})$ is a manifold.

I think understanding this example would clear many of my doubts.
 A: There are some confusing points in your question.
Assume $k$ is a field, not supposed algebraically closed, and assume $X$ is a $k$-scheme, i.e. $X$ comes with a scheme morphism $p:X\to\operatorname {Spec}k$. Then:
a) The notation $X(k)$ denotes the set of sections $s:\operatorname {Spec}k\to X$ of $p$, "section" meaning $p\circ s=Id$.
(Your definition $X(k)=\text{Hom}(\text{Spec}(k(x),X)$ doesn't even make sense since there is an $x$ on the right hand side and not on the left).
b) There is an obvious set-theoretic map $\;$$j:X(k)\to X: s\mapsto s(\operatorname {Spec}k)$.
c) That map is always injective and practically never surjective, which is exactly the opposite of what you claim!
We may thus identify $X(k)$ with a subset of $X$, called the set of rational points of $X$.
d) Those rational points are always closed in $X$.
The converse is false: if $k=\mathbb Q$ the closed point $\sqrt 2\in \mathbb A^1_\mathbb Q=\operatorname {Spec}(\mathbb Q[T])$ corresponding to the maximal ideal $\langle T^2-2\rangle \subset \mathbb Q[T]$ is closed but not rational (as some clever guy proved about 2500 years ago).
Even over the algebraically closed field $\mathbb C$ a closed point needn't be rational: think of the unique point of $\operatorname {Spec}\mathbb C(T)$ !
The correct statement is: Rational points coincide with closed points in a scheme locally of finite type over an algebraically closed field.
e) We may give $X(k)$  the induced topology.
However if $k=\mathbb C$ or $\mathbb  R$ we may give $X(k)$ a finer topology: the transcendental topology, coming from the metric topology of $\mathbb C$.
It is in that sense that for smooth $X$ the set $X(\mathbb R)$ becomes a differential manifold.
