Pirates are always a problem with mining/production or trade corporations and players, especially those who regularly travel through a low-security space while moving to greener monetary pastures.
Basically, it's a common-sense issue. Check the Map for Ships Destroyed, in advance, for the system you'll be entering to get an idea ahead of time how dangerous it is at the moment.
First, don't travel around asteroid belts in lowsec space when there's others in local, and if you do ALWAYS keep your Local chat open, and a close eye on it; by examining the security ratings of those coming in and out of a system you'll be able to get an idea of how dangerous they are--in 0.0, though, security ratings are no indication, as your security rating does not go down for attacking someone in 0.0. If for some very odd reason you decide to go mining alone in a lowsec system, do not mine at the warp-in point of the belt--stay as far off as possible (read the last of the ore-thief tips). Next, don't travel through lowsec without caution; scanning a gate ahead and staying cloaked to scan local after every jump on a 48-jump-journey is a killer, and perhaps not worth the time--BUT it's a good idea to do it if your map says there have been fifty kills there today.
Most other pirate-avoidance techniques have already been covered. But...
If you do get caught by a pirate, you may not be able to call your corpmates for much help. Unless there's more than a couple members on, and those members are nearby and happen to be in PvP ships ready--and if you're SURE the pirate doesn't have friends waiting, and that your corp can take him--unless you have all this, you'll be on your own. Even then, you'd have to stall him long enough for the corpmates to get to you.
You have a few choices with a pirate. You can try to run, try to fight, or you can give him a ransom (assuming he asks). Usually pirates will honor a ransom, but it will be costly (though the ransom is priced to be less than the cost of your ship or, in bad situations, your pod/implants). Perhaps your pride won't allow it--then you can fight him/her, and maybe even win, but probably not; pirates are opportunists and -usually- attack those whom they know they can beat; in addition they will be much more experienced in general. A pirate will usually show up on your screen and immediately begin blinking red (either he's lowsec or trying to scramble you). If you're in an asteroid belt in low-sec (remember: dont sit at the warp-in point) and a ship flies in and flies toward you, run away.
Once you're locked it's time to think fast. Try to run if you can; if the scrambler stops you, he'll either destroy your ship or take you into hull, if you don't fight, and try to ransom you. If you fight he'll probably kill you (or if you're not making a dent on him, he'll convo you for the ransom and say 'stop shooting, silly'). Check ahead of time on any corp policy on whether to pay ransom when carrying expensive corporation assets.
If the pirate ransoms you and you pay, and then he kills you anyway, usually a good thing to do is contact his ceo or alliance and tell them this. Whatever you do, don't yell at the pirate, or be rude or nasty; they get this all the time and it won't help you one bit.
If the pirate has your ship locked down and scrambled and is obviously going to kill you, there's something you can do to help your life pod escape. Just hold down Cnrl-Alt-Shift-E and Cnrl-Alt-Shift-T to turn off all Effects (e) and Turret effects (t). Sometimes if all effects and turret effects are still On, your screen will lag badly (poor frames-per-second) and will pretty much freeze up for a few seconds--and by then your pod might be locked. So use those keyboard shortcuts above to prevent this, and then run! Select a gate or dock, and spam your WARP button just before your ship dies. Continue until your pod is in warp. You can turn your effects back on with the same keys.
Obviously take note of a pirate's name, lower his standings with us so you see him coming next time, and be more careful in the future--learn from every mistake.
Stay Aligned for Warp: Being aligned for warp means that your ship is already facing the direction in which it will warp out, possibly moving, which is even better. You'll notice that when you right-click a dock or other place in space and choose Warp To, there's a delay while your ship turns itself in that direction and reaches a certain speed. The larger the ship the longer the delay; smaller ships tend to be more agile. You can increase your ship's agility, as already noted, with Inertial Stabilizers to turn faster--but it's better if you don't have to turn at all. If you are in low-sec space, and might have to warp out at any time (for example mining, or sitting at a safespot) then point your ship to just above or below the place in space you'll warp to and double-click. This way your ship will turn that way and begin to fly toward it (without going into warp). You can leave it running or stop it, leaving it aligned, to prevent getting ganked (killed) while aligning should a pirate warp in. This is also why it's a good idea to, if you jump into a system with a gatecamp and you're in a slow ship, warp to the object best aligned with your ship, rather than to the gate (assuming the gate would take a few seconds to align to).
Gatecamps: Gatecamps are groups of pirates sitting around a gate, killing everyone they can who is traveling through. Often ships used by them will employ smartbombs to quickly kill smaller, harder-to-lock ships, and will have ships to quickly lock down other travelers. Usually if you plea for a ransom in Local chat they will stop (assuming they see you in time) and offer a ransom, although this price varies depending on what you are flying; some pirates will kill you and ransom your pod, or kill and pod you for fun.
One last note: When doing missions, remember to always check View Mission Details before accepting. Check the info on the system it's in, and don't accept a mission in space of .4 or below. It's all too easy to accidentally accept a mission in .1 or even 0.0 space! Pirates will also sometimes camp Deadspace Complexes, remaining hidden or cloaked until you're fighting the npc's, then jumping from out of nowhere while you're preoccupied and killing you.