To add to Jake Westfall's answer (https://stats.stackexchange.com/q/408410), we can consider the marginal density as integrating out the other variable. In detail, if we have $(X, Y)$ being two random variables, then the density of $X$ at $x$ is
$$
p(x) = \int p(x, y)dy = \int p(x | y)p(y)dy,
$$
which when the variables are discrete, for example if $X$ and $Y$ only take on values of $1, \dots, 6$, then finding the probability of
$$
p(X = 1) = \sum_{y = 1}^6 p(X = 1, Y = y)
$$
which is the same as summing the elements in the first row ($i = 1$) of his table.
I think it's easier to view this in terms of a plot though. Below is a plot of the joint density when sampling from a mixture of two Gaussians, the marginal of $X$ and $Y$ to the top and on right respectively

Same plot with smoothed densities (you can think of this as the same but with $X$ and $Y$ now being continuous, in which case you can still find the marginal, but we will use an integral instead of summing)

Both of these plots were generated using the jointplot function from seaborn (https://seaborn.pydata.org/generated/seaborn.jointplot.html#seaborn.jointplot).
Hope this helps!