When people go out and buy a brand new motorcycle the first thing they are told about is the "Engine Break-In Period". This is from the first time the motorcycle is turned on to about 1,500 miles. New engine parts rub together with some friction but after "breaking-in" the engine pollutes less, gets better gas mileage and the life of the engine is extended. There are many steps involved but the first step is "avoid a constant engine speed."
"Avoiding a constant engine speed" means "rev the engine". You will likely see this at a stop light and believe the rider is doing it to be "cool". Well, sometimes that is the case, but it is also very likely the Rider is doing what is necessary to make sure his or her engine works properly for the rest of it's life. When stopped at a stop light the engine idles, which is a constant engine speed. Since a motorcycle in the break-in period should avoid a constant engine speed, the Rider revs the engine. What it boils down to is that if you do not "break-in" your engine you will get bad mileage or even ruin it.
2. A repaired engine might also require it.
It is much easier and cheaper to remove and repair a motorcycle engine than a car engine. Many Riders do it themselves. A motorcycle with a damaged engine is rarely thrown out. Riders will take an engine apart, put new parts in and put it back together, or have someone else do it. When they do it starts a brand-new break-in period. In this case the bike might be old but the engine insides are new. This happens a lot more then you would think.
Custom choppers, ancient classics and newer bikes that were broken in wrong could all be in a break-in period due to a recent engine repair. Additionally, a bike that has been stored all winter might have a problem with the carburetor that will make the engine quit if not revved. Carburetors can be very tricky can have a problems running in certain weather conditions with revving the engine.
3. Sometimes it's a safety technique.
Downshifting is integral to safe riding of a motorcycle. A safe Rider NEVER simply shifts to neutral and coasts to a stop. Riders know that when they are slowing to a stop sign or moving through certain areas they are more vulnerable to being hit from behind or from cars pulling out from the side. They might need to accelerate to avoid a collision and if they are in the wrong gear they might end up stalling instead of getting out of harm's way. So a Rider needs to ensure that he or she is in the right gear while slowing. Since most bikes don't have an automatic transmission (a few do and they are not that expensive), they have to do it themselves. This means - you guessed it - revving the engine while selecting the lower gear and repeating through all of the gears until stopped. This is called downshifting and engine braking.