What you want to do is shift at either:
1) The point just before the rev limiter kicks in,
or
2) The point at which the overall gear ratio for the next higher gear supplies more
torque to the drive wheels than the current gear ratio.
In most cars, the gears and the engine's torque curve are spaced such that (1) is the best option, but if a car has an absolutely massive (and I do mean massive) falloff in torque in the upper part of the rev range, it can sometimes be best to slightly short shift.
Remember, a car is propelled forward by the torque at the drive wheels. This varies not just with engine RPM, but with the gear selected as well. If you have a 1:1 gear ratio, the engine torque and wheel torque are the same, if you have a 2:1 gear ratio, the torque at the wheels is
double the torque at the engine. What you want to do is always maximize the torque at the wheels, which means you
don't want to shift immediately at the engine's peak since you lose the torque multiplication from the lower gear. In general, you're better off holding the lower gear and keeping the torque multiplication than grabbing the higher gear and putting the engine at a lower RPM where it makes more torque.
For example, using purely invented numbers just to illustrate the math, let's say that an engine hits peak torque of 75 ft-lbs at 5,000 RPM, makes only 65 ft-lbs at 6,000 RPM and falls off further to 55 ft-lbs at the 7,000 RPM redline. Let's say that 1st gear has a 3.5:1 ratio and 2nd has a 2:1 ratio. At redline, the engine is only making 55 ft-lbs of torque, but because of the gear ratio, the wheels are actually getting 55*3.5 or 192.5 ft-lbs of torque. Even at the engine's peak output of 75 ft-lbs, shifting to 2nd only gives the wheels 75*2 or 150 ft-lbs of torque.
Even though you're past the engine's power peak, the wheels still get the most torque by waiting until redline to shift because of the way gearing works.
For a more detailed treatment, I highly recommend this link:
http://vettenet.org/torquehp.html