What everyone else has already mentioned, but there are a few more things to practice. One, avoid riding in the center of the lane. After the rainy season ends and the hot weather begins, fluids that have leaked from cars including oil, transmission fluid, antifreeze and condensation from AC will all migrate and collect in the lane center. Also, when coming to a stop at an intersection or in traffic, staying off to either side of the lane will allow you a quicker exit path in case someone might hit you from behind. Also, when in traffic staying out of the center of the lane will help to prevent you from blending into the back of the vehicle in front of you.
Watch the drivers in your vicinity. Their head position often gives away their intention or lack of attention such as looking at their phone. Glance into their mirrors and you can see where they're looking. Also, watch their wheels. If the wheels are ****ed, they're probably intending to move in that direction. Here in California, we're allowed to "Whiteline" or better known as "Lane splitting, lane sharing". The California Highway Patrol actually recommended guidelines for safe lane splitting and they advocate it as a safer practice for cyclists, since cagers are usually unaware and unconcerned with Motorcyclists.
If you intend to carry a passenger, throw a bag of sand on the back and practice maneuvering at slow speeds. Practice slow speed maneuvering with or without the additional weight every chance you get. Learn to countersteer in the twisties. Don't overestimate your ability! Don't overestimate the equipment. Check the oil and air pressure before each ride. Inspect the brakes every tankful or two if you're a casual rider. Don't be a Squid! I hate helmets and always have. I've ridden a couple hundred thousand miles in my life without a helmet, but since they're required in my State for a few decades, I've become accustomed to them. I've grown to appreciate the lack of bugs in the face, but they're still uncomfortable in heat, and I hate not having peripheral vision and limited hearing. What's gained in protection in the case of an accident is perhaps lost in accident prevention. Wear armor or heavy denim/leather and boots. Watch out for shoelaces that can get hooked on the bike. Wear gloves always, whether it's hot or not. Make sure your lighting is operational and use your turn signals to alert cagers.
I've been rear ended 3 times while stopped, and I've been run into by a lane changer just like one of the other posters above. We made eye contact and while looking directly at me, changed lanes right into me. He was an elderly gentleman, and I was anticipating something so I was able to kick off and stay upright. I've had cars around my area at least once a day run through red lights.
Motorcycles aren't just fun, they're a way of life for most of us here. But with old age comes some wisdom, and though aggressive riding is really fun, I'm very defensive these days. I ride with extreme caution, and in fact, I don't really enjoy riding the highway much faster than 70-75. At 80, there's too much wind pressure.
Oh, and this is important. On extended rides, if you're getting tired and/or sore, take a break! What's the rush? When you get tired, you relax a bit, and aren't paying as much attention. Gravel, sand, leaves, paper or plastic bags, alligators (18 wheeler retreads), milk cartons are all waiting for you around the next turn.
All of this will become second nature, but it takes some time and patience.
Ride safe, my friend and enjoy the ride! And, as others mention, only bikers know why dogs hang their heads our of car windows.
Wayne
San Francisco