What exactly is a shapefile in ArcGIS, and how is it related to a database or a layer file. What are the differences between these 3 things?
A shapefile is a simple, nontopological format for storing the geometric location and attribute information of geographic features. Geographic features in a shapefile can be represented by points, lines, or polygons (areas). The workspace containing shapefiles may also contain dBASE tables, which can store additional attributes that can be joined to a shapefile's features. It is worth noting that shapefiles have no relation to databases, rather when shapefile features are added to a database they are transformed into database rows, which have no direct relationship to the source feature.
In comparison to a shapefile, a layer file is a just a link\reference to actual data, such as a shapefile, feature class, etc. It is not actual data because it does not store the data's attributes or geometry. A layer file primarily stores the symbology for a feature and other layer properties related to what is seen when the data is viewed in a GIS application.
A database is where you can store the collections of data that the GIS software can pull from to recall information stored within it when needed. Databases often have various ways to retrieve information stored within them.