Calculating the mean
Add up every value, then divide by how many values there are. For 2, 4, 4, 4, 5, 5, 7, 9 (8 numbers), the sum is 40, so the mean is 40 ÷ 8 = 5.
Calculating the median
Sort the list first. With an odd count of values, the median is simply the middle one. With an even count, there's no single middle value, so the median is the average of the two middle values. The same list, 2, 4, 4, 4, 5, 5, 7, 9, already sorted, has 8 values — an even count — so the median is the average of the 4th and 5th values (4 and 5), giving (4 + 5) ÷ 2 = 4.5.
Calculating the mode
Count how many times each value appears; the mode is whichever value has the highest count. In 2, 4, 4, 4, 5, 5, 7, 9, the value 4 appears three times — more than any other value — so the mode is 4.
A second worked example, with an even-count median
For 3, 7, 8, 12 (4 numbers, already sorted), the mean is (3 + 7 + 8 + 12) ÷ 4 = 30 ÷ 4 = 7.5. The median is the average of the two middle values, 7 and 8, which is also 7.5 in this case — purely coincidental, not a general rule. None of the four values repeat, so this list has no mode.
Where these formulas come from
All three answer a version of "what's a typical value in this list?" — but they use different information to get there. Mean uses every value's magnitude, median uses only each value's rank/position after sorting, and mode uses only how often each value repeats. See the companion article on choosing between mean, median, and mode for when each answer is the more useful one.