Expected value: conceptual link between $X$'s values $x_i$ and probability function $P_X$ https://en.wikipedia.org/wiki/Expected_value
for a random variable $X$ is given by
$$\mathbb{E}(X)=\sum_{i=1}^{\infty}x_ip_i$$
the $p_i$s are given by the probability distribution (probability function) of $X$.
Are the probability distribution and and the values $x_i$ necessarily linked?
Or
What are $x_i$s in relation to $p_i$s?
 A: The values $x_i$ are the range of $X$. That is, $x_i\in\{z:p_X(z)>0\},$ where $p_X$ is the p.m.f. of $X$.
A: It seems that your confusion is about $X$'s in general. First, you could start with two nice threads that provide definitions and intuitions of random variables. Next, we can try translate it to the plain English. There is some random variable $X$, that has some domain $\Omega$. $\Omega$ is a set of all the possible outcomes of $X$ (all the possible $x$'s). Sometimes $\Omega$ contains only zeros and ones, sometimes it contains only integers, sometimes all the real numbers - it could be anything, but for each random variable the domain is defined.
Next, let's define what $P_X$'s are. $P_X$ is a function that returns numbers from $[0, 1]$ range for each of the possible $x$'s. It can be any function that obeys few axioms defined by Kolmogorov, but this is of less importance in here. $P_X$ function can return the same values of probability for different $x$'s (for example there is $0.5$ probability of throwing head and $0.5$ probability of throwing tail). So it's $P_X$ function that returns probabilities for $x$'s - that is the relation.
The relation between probability $p$ and $x$ such that $P_X(X = x) = p$ exists only in terms of this $P_X$ function and $X$ random variable, while $x$'s are possible values of $X$.
A: If we have a discrete random variable $X$ on $(\Omega, \mathscr F, \mathbb P)$ that has range $x_1, x_2, ...$, then we have
$$E[X] = \sum_{k=1}^{\infty} x_kP(X=x_k)$$
Hence the $p_k := P(X=x_k)$
