I don’t understand why mean is defined in such way. In statistics when a data is given we define mean by sum of the data given divided by no. if values but in discrete probability distribution and continuous probability distribution we define mean by multiplying random variable with respective probabilities So why is that

I don’t understand why mean is defined in such way. In statistics when a data is given we define mean by sum of the data given divided by no. if values but in discrete probability distribution and continuous probability distribution we define mean by multiplying random variable with respective probabilities So why is that