Keeping a safe distance from the vehicle in front of you is a cornerstone of good driving. If you are too close to their bumper, it reduces the time you have to react if they brake suddenly. It also reduces your view of the road ahead, especially if the vehicle in front is large.
Despite how obvious this is, many drivers fail to leave sufficient distance. Even worse, many of them sit far too close to the vehicle they want to pass, making it much harder to see when it is safe to overtake.
The recommended distance for following someone is three seconds in good conditions. It needs to be more in bad weather or on a poor surface.
What if someone refuses to leave enough space behind me?
You can only control your own driving behavior, and if someone is being an idiot and sitting on your bumper, you cannot do anything to make them stop. Some people think that slamming on the brakes will teach them a lesson, but it is likely to end up with them either rear-ending you or making them even angrier than they may already be.
Not all tailgaters are angry, of course. Some are just dozy or distracted or do not realize the dangers of driving so close. The best thing you can do is let them pass as soon as it is safe for you to move over. If they then go on to tailgate someone else, at least you will be safe.
If a tailgater does crash into you, getting angry at the scene will not help your cause either. Finding out how to hold them responsible for the crash will.