If you're on foot, you're obviously going to be running, but you need to do so smartly.
Your instinct will be to run directly away from the attacker, since a direct line is the shortest; however, you need to fight this tendency and make random cuts in your flight pattern. A moving target is fairly hard to hit, but if you're running in a straight line it's much easier, since you only have to correct one aspect of the aim if you miss.
Don't run in a simple zigzag pattern, or in any other predictable way. In order to hit a moving target, a shooter is going to have to "lead" you with the gun, swinging it ahead of where you are to where he or she thinks you'll be. If it's impossible to know this, you will be that much harder to hit.
Make use of concealment and cover as much as possible. Concealment is anything that obscures your body, but won't necessarily stop a bullet; cover is a barrier that is reasonably bullet resistant. If there are trees, shrubs, buildings, vehicles, or anything else around, work them into your flight pattern and get them between you and the shooter.
Try to head toward a place of safety. If there is any kind of police presence nearby, that's obviously your first choice. If not, any kind of governmental building, then any corporate or public center that might have security, then any accessible space you can access and secure behind you.
Failing all that, see if you can find cover just long enough to call 911 or your local equivalent. Stop just long enough to dial, then keep going. You're going to be long on panic and short on oxygen, but if your attacker has fired any shots there is a very short phrase you must get out clearly: "Active shooter at [your location]." If they're just armed and in pursuit of you, then "Man/Woman with a gun at [location]."
Addresses with numerics are best (5874 South Main), then intersections (Main and First), but any landmark you can get out will suffice. An active shooter call from an out of breath caller will get the cavalry rolling hot.
If you can find more cover, try to update dispatch - they're going to be ravenous for more information. Try to tell them your direction of travel, the type of gun involved (handgun, rifle, or shotgun at minimum, but more detail if you're certain of what you're talking about), and the suspect's description. If the suspect is wielding anything bigger than a pistol, please let dispatch know as soon as you can. Shotguns will change tactical response, and ballistic vests don't stop rifle rounds, so responding officers need to know about these before they get there.
Tied to the above, know your weapon. First, this is a shotgun; note the thumping report.
Then, a bolt action rifle. Most will have scopes as shown below, but you're frankly quite unlikely to be getting shot at with this - and if you are, the shooter is likely stationary, anyway:
Then, a pistol, which is by far the most likely weapon you'll be fleeing. Note the cracking report. This is a Glock 17 9mm, which is what I carried on the street:
And then, of course, we all know what automatic weapons look and sound like. If you're personally getting chased by someone with an automatic rifle, you probably don't need any advice from me.
As police arrive, try to find a place to keep your head down, and follow dispatch's directions regarding what to do from this point.
If you're in a vehicle, this is probably going to be an easier process:
In the case of an active shooter in their own car chasing you, drive as quickly as you safely can to a police station as you dial 911. I emphasize safely, because if you wreck out you're going to be stuck in an immobilized metal box while your attacker quickly closes distance.
Try to keep your head down as much as possible, but, again, safely - don't let the dashboard obstruct your vision.
Don't put effort into swerving like you would on foot. There are so many factors that make hitting you incredibly difficult (inability to fire down line of sight, lateral movement, divided attention, propensity of bullets to glance off of angled back glass, and on and on) that you don't need to risk losing control just to introduce one more.
If you don't know where a police station is, find a major highway and try to keep your distance. Whatever you do, don't wander into residential areas - you never know when you're going to hit a cul-de-sac or loop that's going to block you in or put you face to face with your assailant.
Like above, follow dispatch's instruction - they're going to put you on a path to be intercepted by responding officers.
Obviously, this will be a unique and dynamic situation. You're usually going to know, based on the situation, what you need to do to stay as safe as possible; if you can do this for 1-3 minutes (probably the top end of Code Three response time in a metropolitan area), you should have a police officer between you and your attacker.