Before you eject, align to a station. Right click your capacitor and select eject. Immediately begin spamming the dock button.
If you are fighting NPC's with drones and someone loots one of your cans they will become suspect flagged and you can shoot them without CONCORD intervention. After killing an NPC your drones will automatically engage them regardless of whether or not you are manually controlling them, flagging you with a limited engagement timer, making the pirate able to attack you at their leisure; even in high security space. The only way around this is to set your drones to passive. If they do something to make themselves start flashing on your overview, what you should really do is stow your drones and dock up until they lose interest.
If you are PvE fit, Whatever you are flying, they are going to mop the floor with you. Do not think you are going to stand a chance. You will be very sorry when you are warp scrambled and neuted. Especially if you are flying faction hulls, or pimped out ships.
Do not forget to thank the pirate for an interesting time. This is important. It denies them the second thing they want: tears. So thank them, and then say nothing else in local. Ignore them.
Sadly, you can't deny them the last thing they want: ISK. They have your whole ship, and probably made out like a bandit (no pun intended). Lucky for you, this is probably the only thing they don't even care about, as most pirates have been doing this for a long time and are space rich. So they will probably just blow up your ship, loot it and go looking for their next victim.