Your legal status is displayed in the right panel. It is defined by a value called Alert Level. Generally, doing illegal actions will raise this value. However, a high Stealth skill allows you to avoid being chased by the police, it's called Laying Low. As long as your Alert Level is lower than your Stealth divided by 2, cops won't actively chase you except if you do something stupid just in front of them.
Your Alert Level will decrease by one per turn, no matter what you do.
The main law in the city is that killing people is a bad thing. Successfully shooting at (or killing) a cop or civilian will raise your Alert Level. However attacking gang members won't raise it. So it may be a good idea to attack them first to collect some free loot.
Robbing shops is highly illegal, failed attempts at Lockpicking or Pickpocketing may result in your Alert Level being raised. Also, most citizen don't like when you are stealing their stuff just in front on them. Also raising an alarm by failing at picking a lock may trigger a nearby cop to inspect the location.
In the current build (0.6.7) this is not fully implemented. However, staying is a private area, if detected by a NPC will trigger an alarm. Guards who are on site will attack you. And the owner of the place may call in reinforcements (cops for civilians, thugs for gangs, and so on).