Depends on the power curve. Take a look around peak power. For example, if you have a broad power band before it peaks, then it just dives off, you would probably be best off shifting right where it peaks. Or some car with a stage 3 turbo, steep climb to peak power and then it dives off. You would want to shift a little over peak so you can keep as much power as possible when you shift. So sometimes shifting before redline, or running it all the way up to the limiter may not be the best option.
Remember, every car is different. Many factors in an engine can determine how it delivers power. I like how you can see the dyno sheet of the cars in this game; I think this is exactly why it is there since you can't fine tune parts.