The postcode data is published on the Office for National Statistics postcode page and is licenced under the Open Government Licence © Crown copyright and database right 2017.
Postcode centroids show the approximate centre of a polygon that the postcode applies to. Postcodes seem to never apply to more than one street. Some streets are broken into multiple postcodes. Sometimes this is by breaking the road up into chunks and sometimes one side of a road has a separate postcode from the opposite one. Sometimes it is a combination of these. Some buildings that receive a large amount of post have their own postcodes. In a few places multiple postcodes apply to a single place, again to facilitate post deliveries.
Last updated with the data available from March 2017
PLEASE do not add the centroids to the OSM map database. The centroids are not real objects so they do not belong in the OSM database.
To see postcodes on an openstreetmap map you can use oscompare with the postcode layer turned on.
If you want to search for a GB postcode and see it on a map try Postcode finder.
To see the postcode overlay in the JOSM editor:
http://www.raggedred.net/tiles/onspd/{zoom}/{x}/{y}.png
To see the postcode overlay in the iD (online) editor:
http://www.raggedred.net/tiles/codepoint/{zoom}/{x}/{y}.png
To see the postcode overlay in the Potlatch 2 editor:
http://www.raggedred.net/tiles/onspd/$z/$x/$y.png