It depends upon the situation. If you're in no big hurry 3-4k is adequate. If a 80,000 lb semi is bearing down on you, then you better red line if before you get squashed. If you're sneaking away from a jealous man's house after he came home early and you crawled out the bedroom window, then you better short shift it and not exceed 2k.
As far as a new bike goes, the first 500 miles or so, try to not exceed around 60% of the redline rpm. For example, if it redlines at 10,000 rpm, then try to not exceed 6,000, especially for extended periods of time. As you get more miles on it, you can gradually up the maximum rpm until around 1,000 miles. After that you can knock yourself out.