If outcomes have different probabilities, you still use the same formula: multiply each outcome by its probability, then sum.
Example: a weighted coin where P(heads) = 0.7 and P(tails) = 0.3. Assign heads = 1, tails = 0.
E[X] = 1×(0.7) + 0×(0.3) = 0.7.
This means you get heads 70% of the time on average.