Riding a motorcycle requires constant vigilance of your surroundings, especially other vehicle. The common dangers for riders -- vehicles turning in front of them or pulling out in front of them -- are well known. But motorcyclists don't often consider the significant potential for danger when passing other moving vehicles. A mistake that occurs between two four-wheeled vehicles when one's trying to overtake the other may result in a squealing of brakes to avoid a collision and at most a minor fender bender. That same situation can result in serious injuries or death when its a motorcycle that's doing the overtaking and an accident happens, either because the rider has to take evasive action and crashes, or because of an actual collision that throws the rider from the motorcycle.
All of us riders know that there's little we can do to protect ourselves from other drivers' lack of attention, lack of vision, and bad driving habits. It's a roll of the dice any time you mount up. You just hope that today's not the day that your name's included in the news story referencing the driver "who just didn't see the motorcyclist." But you can at least increase your chances of avoiding an unlucky dice roll by taking certain steps, some of which always apply and some of which are special to passing situations.
Most importantly, assume and act like none of the drivers see you. That way you're always prepared when someone inevitably turns or pulls out in front of you or moves into your lane as you're trying to pass them. When I'm passing a vehicle, I expect them to either not look or miss me me when they do and then move into my passing lane or turn into me as I'm passing. That way, I'm always prepared and am pleasantly surprised when I complete my pass without being run off the road. In this regard, don't rely on the nonsense that loud pipes are all you need for people to notice your bike. You don't know for sure that the other driver will hear your bike or be able to pinpoint its location even if the pipes are heard.
Also, make sure your head lamp's working. Even if you have an older bike and can legally ride without your headlight on, do not under any circumstances do so. You might as well be invisible as far as other drivers are concerned, especially when vehicles, buildings, or the landscape behind you cause you and your bike to blend in with the scenery. That's even worse when trying to pass a vehicle, because that other driver may at most give the rearview mirror and blindspot a quick flick of the eyes before moving over into your passing lane to turn or likewise pass vehicles. The best practice is to always have your high beam on during the day to increase your visibility for other drivers. The high beam also makes you appear closer to the other driver, reducing the "I thought the bike was farther away than it was" issue.
You need to pick the right time to pass; if the right time hasn't presented itself, then just sit back and putter along until passing conditions are safer. Bad passing conditions include intersections, driveways, turning lanes, blind crests, blind corners, and anything that may restrict vision or cause another vehicle to pull into your path or turn across it. The only time you should be passing a vehicle, particularly on the left on a two-lane road, is when you're on a straight section of road with no or minimal opportunities for cross-traffic or turns and plenty of visible road and terrain ahead.
When you do pass vehicles, do so with some urgency. You need to get out of the other driver's blindspot and complete your pass as quickly as possible. This is not the time to slowly creep past the other vehicle.
This is also not the time to enjoy the scenery, especially if you're passing on the left on a two-lane road. You obviously have to watch for oncoming traffic in the lane you're using to pass. You also have to watch the lane next to your passing lane for anything that may cause the driver next to you to also suddenly decide to move into the passing lane while you're still next to the other vehicle. And you of course have to monitor the other vehicle and driver for any signs that the driver may be accidentally or intentionally moving into your passing lane.