We play by the rules here. No ramming, no intentional taking out others etc. If a driver does not follow these rules, he should go elsewhere, like Vanilla GTA random races.
If you are one of the slower drivers in a race (a "backmarker"), then it can happen that other drivers lap you. In this case the faster driver honks behind you. Have a short look backwards (or at the mini-map) to make sure that it isn't a driver that you are battling for positions, and then make room for the faster driver. Making room means that you go off the racing line, like in a corner stay on the outside line decelerating a bit, so the other person can overtake you in this corner. Or on a longer straight stay on one side of the road, release the throttle so you can be overtaken easily.
If you take out another driver by accident, so the other person gets off track, you have to wait for them to catch up and retake their position in front of you. Usually, do not make a full stop right away, but rather look for a good spot in the next ca. 10-100 meters; get off the racing line - maybe on the grass / sidewalk next to the road and wait there for the person you took out.
Lag hits happen, since all the positions of other drivers need to be updated via the internet, and this takes time. Here is an example of a typical lag hit. Both drivers were quite surprised when it happened: https://clips.twitch.tv/CheerfulSmokyGoatUnSane
Sometimes you'll see a car that you're battling with skid unexpectedly and lose control. This is called a lag hit. You didn't do anything wrong, but the Internet was just mean to you. Be a gentleman / lady and do the same as mentioned in the paragraph above. Get out of the racing line, slow down / make a full stop, and wait for the other driver.
Every race is the same: Some idiots in front of you crash into each other in the very first corner. So what can you do? Do not push through the pile of cars! Just decelerate or even stop your car! Smile at the carnage and look for a clean and easy opening. Enjoy your clean overtake of dozens of fools who do not know how to do contact racing!
So you've been taken out. Your car is on the racing line facing backwards. The best way to handle this is to get off the racing line as quickly as possible, check the mini-map for incoming cars. Wait until traffic is gone, and only when you see a clear opening, get back on track and resume driving.