Shale is fine sediment pressed together to form rock.
Sandstone is larger (sand-grain-sized) sediment cemented together to form rock.
Shale erodes faster, as evidenced by the second attachment. That attachment shows erosion of a rock face consisting of interbedded shale and sandstone. The shale has receded significantly, leaving the sandstone layers with space between them.