Usually, in the integration, $\int_Xf(x) \, d\mu(x)$, people assume by default that $X$ is infinite.
If $X$ is finite, then people usually write: $$\sum_{x\in X}f(x)p(x)$$
Where a widely used interpretation of $p$ is probability. My question is, if $X$ is finite, can we still use the first notation? If $X$ is infinite, can we still use the second notation? Is summation always a strict special case of integration?
What is the proper notation to use if $X$ could be finite or infinite? i.e. we don't know the cardinality of $X$.
If $X$ is infinite, the sum notation can still work if $X$ is countable for example.
I would say that the link between sum and integrals in your case can be seen by writing the counting measure as a sum of dirac distributions $\delta$. Then by defining $μ(\mathrm{d}x) = \sum_{y\in X} p(y)\,\delta_y(\mathrm{d}x)$ it holds $$ \int_X f(x)\,μ(\mathrm{d}x) = \sum_{y\in X} p(y)\,f(y) $$ If $X$ is uncountable, you will have to write integrals.