Transfer has an amazing collection of images of 'Anti-Sit' devices, mostly in New York but also internationally. Taking a look through the photos, it's clear that only in a very few cases (the air-conditioning units and standpipes, for example) are there real 'functional' reasons for preventing people sitting down on them, i.e. to prevent possible damage. In most of the examples, the spikes or jagged edges appear to have been put there purely as social engineering: these are public spaces and yet the public is being subjected to an architecture of control which says "You can't sit (or lie) down here and rest. Move on." Indeed, it's almost as if someone despises the public, or at least those members of it who want - or need - to sit down.
Nail-type spikes are common in many towns here in the UK to prevent pigeons or other birds perching on particular ledges or window sills, particularly on higher level features that would be difficult to clean, but I don't think we (yet) commonly have the degree of anti-sit architectures of control shown in the Transfer examples - though I might be wrong!
As some of the comments note, the possibility of someone tripping or falling onto some of these spikes, and being seriously injury (and litigious) is surely something to consider? Car bonnet mascots have been outlawed due to the possibility of injury to pedestrians, and yet councils and building owners are allowed to fit far more dangerous devices such as these spikes, which are specifically designed to injure pedestrians who aren't warned off by their appearance.
Thanks to Deborah for letting me know!
Images from Transfer: The Anti-Sit Archives