It's easy for gamers to get caught up in the "Gambler's Fallicy," which is, in a nutshell, that if a bad result has been repeatedly coming up (dice, roulette, cards, whatever) that it is increasinly likely for a good result to come up. That is, if I've been rolling 1's all night, surely a few 20s are coming up. This is, however, untrue. Each roll of a d20 has a 5% chance of being any particular number, no matter how many or few times any particular number has come up previously (assuming a fair die). As Bagpuss said, the die has no memory of its previous activity.
This is a common problem for people who really want a child of a particular sex. After five boys, they often start thinking, "surely the next one has to be a girl. What are the odds of having 6 boys?" This is incorrect thinking. The odds of any particular child being a boy are 50/50. The odds of six 50/50 situations ending in the same result are vanishingly slim, but each individual situation remains unimpacted by those that have gone before.
As far as dice are concerned, the average roll on a d4 is 2.5. This makes sense because, on a d4, one-quarter of all rolls will result in a "1". One quarter of all rolls will result in a "2". One quarter of all rolls will result in a "3". One quarter of all rolls will result in a "4". So you can figure out the average value rolled by taking the average of these possiblities:
(1+2+3+4)/4 = 2.5
The equation you posted is a mathmatical shortcut. It assumes that each die is numbered sequentially beginning at 1 and ending with a number equal to the number of sides. This is, of course, true for all dice we actually use. A theoretical six-sided die that is numbered 2, 4, 7, 9, 14, and 17 would produce an average result of 8.83.
Your equation is good for all situations that will occur, and PC's and mine are good for all situations that can occur (but really never will).