A layer within OpenStreetMap can have different meanings, depending on context.
Viewing a slippy map
When viewing an interactive slippy map (e.g. on osm.org) you can often choose different Map Layers. They may show different views of the same dataset, or they may be placed on top of each other to show content from different data sources. Many providers offer very specific views on the OSM data, see the List of OSM-based services.
When editing, the layer=* tag is used to describe vertical relationships between crossing or overlapping elements, e.g. a bridge over a street.
For describing different floors within a building or multilevel parking decks use level=*.
Usually a layer contains a related (but different!) set of data. As an example, in JOSM you can determine which layer gets displayed on top of which other layer while editing (or to not display them at all). There are layers for:
- different sets of OSM data
- GPX tracks and markers
- pictures from several WMS'es you can trace over
- various plugins
According to a post  there are: about five different sets of nested "layers" concepts in the mapnik rendering setup.
OSM layer tagging is converted by Osm2pgsql into a z_order parameter in the PostGIS/PostgreSQL database. It has been experimentally determined that this parameter for a polygon is set to 10 times the OSM layer value. When retrieving planet_osm_polygon data you can use an "order by z_order" instruction to ensure layers are rendered in the correct order on the same spot. This is not an alternative to using Relation:multipolygon to cut holes in geometry where a feature does not apply.