This has been posted before but bears reposting given the recent events where the police have been arresting, harassing and otherwise illegally interfering with the public's right to photograph events occurring in public places.
It is best to clearly know your rights prior to finding yourself in the stressful situation of facing an irate police official making illegal demands and threatening to arrest you for failing to follow their illegal instructions.