* In "High Sec" - you can shoot whoever you want. When you shoot somebody without the right to (ie, they stole from you, you can shoot them), then you have a few seconds (up to ~30) before an invincible NPC navy shows up and blaps you. If you escape, it's a game exploit and is bannable. Not that a few seconds is plenty of time to kill an unsuspecting player (and that does happen and can be profitable, even after losing your ship).
After killing somebody in high sec, your global security status gets decremented. If it gets low enough non-invincible navies will follow you around to try and kill you when you show up in safe space. This is more annoying than anything, and you just have to be careful and keep moving.
* Low Sec: You can shoot anybody, and no navies will stop you. At certain spots, "gate guns" will help out the agressors.
* Null Sec: Anything goes, shoot who you want, do what you want. This is where player controlled alliances live (if you remember reading about Goonswarm and similarly large organizations).
-------------------
It's a relatively complex system, but then again, everything in eve is complex. But fun and deep. The devs are really good about setting rules, and then allowing you to do anything you want inside those rules.
For example, a standard rule of thumb for freighter pilots is to only carry about 1 billion in-game currency worth of goods at a time. Reason? Because it costs about that much worth of ships to blow you up before concord (invincible navy) shows up and kills a group trying to gank your ship. This is just standard knowledge about what is "safe". Which really just means "what would make this unprofitable for people to do to me".
2nd sentence contradicts the first.
As an example, let's look at the classic non PVP activity of mining. Mining is a race against others to get all the asteroids before they are gone. Sure, you didn't directly kill anyone, but those asteroids you destroyed are gonna be gone for at least a few days. Thus preventing access to them by another player. Meanwhile, some enterprising gentlemen are trying to steal the ore you are creating. Once you get the ore back to the station, someone else is buying the at vastly under the going rate but offering local pickup. A third girl is offering a kings ransom if you drive the whole pile of stuff over to the bad side of town and drop it off at pirate central. You decline both offers and decide to set up a sell order for a reasonable rate. You make money
That is non PVP in eve, only three people tried to screw you over. You screwed over some smaller miner by strip mining an asteroid belt, made some money selling the loot to other players. You avoided an attempt to screw you by the market, one by a theif, and an obvious pirate trap. But nobody shot at you. No one declared war on you.
Good times.
In some areas of space, killing people has consequences, specifically, losing your ship. Which just means that you should fit it for firepower/cost when you go shooting random people in highsec. Various parties have honed this to an art, for example: miniluv (Goonswarm Ministry of Love).
Their handiwork: http://community.eveonline.com/news/dev-blogs/28640
Choice quote: "There’s just something special about building 15,000 spaceships and loading their guns with 1 round of ammo to shoot. And doing it right in front of the police."