When helicopters fly over a city, how do they avoid colliding with each other? For example, after a shooting or accident, both police and news helicopters could head to the same spot.
Just like other aircraft flying VFR, see and avoid. Helicopters fly slower, which gives them more time to see and be seen.
They also have transponders and ADS-B requirements so it will be possible to see them electronically too (with TCAS today and ADS-B in in the near future).
While helicopters could technically have no transponder and hence no ADS-B requirement, operating inside big cities leads to the under class B veil, which ends up forcing transponder / ADS-B requirements anyway. What I really mean is there's little logic in owning a helicopter that can never go into the big city, those are usually expensive enough to warrant being able to go anywhere, unlike some old cheap piston planes.
Usually collision avoidance is performed simply by not having two aircraft operate in the same place at the same time. By that I mean that two aircraft which need access to the same location in air will visit it at different times. Collision avoidance is provided by avionics of many modern aircraft and a requirement in some (but not all) places helicopters might congregate. Your question, though, supposes that multiple helicopters need to be in the same place at the same time for a particular reason. For that reason, normal rules of separation or electronic means such as ADS-B or TCAS may not apply.
Vertical offsets are generally used to keep any aircraft from colliding. In situations where multiple helicopters operate in the same incident they will often be in direct communication with each other to deconflict. In other cases ATC will assign altitudes to each. Remember that when operating VFR in dense airspace the copilot (by which I mean guy not flying rather than guy who isn't the PIC) does little else than coordinate traffic and clearances. Pilots who operate the same areas tend to know each other at least by behavior and reputation. They "Know what the other guy will do" and back it up with communication. Obviously, there are assumptions in this approach that can be problematic. For an example of this situation, check the NTSB report from the 1986 Grand Canyons collision. In particular check Appendix G, page 43, which lays out the procedure for avoiding future collisions.
The basic idea of the above procedures is that planes will fly set routes separated by time over target rather than by spacing. This is, after all, how all major airports keep aircraft from conflicting on takeoff/landing. Even then pilots and ATC must be vigilant about aircraft moving at different rates. Failures to do so resulted in a crash in Argentina and, although not involving helicopters, the infamousGreen Ramp Disaster.
Of course, if several pilots decide they don't mind operating close to and at the same altitude as each other, then ATC will let them do it and may even encourage it, since it is safer for pilots to see and avoid than to be deconflicted by arcane rules or radar guidance. The Pilot is in charge. If several pilots decide they are safer being at the same altitude where it is easy to keep tabs on each other, that is their call to make. Their actions are generally only compared to rules or regulations if something goes wrong.
In more general terms, certain altitudes or geofences might be set up and reserved for specific operations. As an example, in an imaginary city, 900 to 1400 feet throughout the class charlie might be reserved to the use of medevac helicopters. Other aircraft might be able to transition or establish there but only with good reason and clearance. Consider the Auckland Mid-Air to see how such rules exist in one city and how the aviation authorities view pilots operating in these situations.
As a side note, avoiding midair collisions was a major impetus to the creation of the US FAA.