Sedimentary rocks form through the weathering of pre-existing igneous, metamorphic and sedimentary rocks into sediments, which are then transported and deposited in layers. Weathering occurs through mechanical and chemical processes, with the rate controlled by factors like climate, rock type, and topography. Erosion removes the weathered sediments, which are transported by agents such as water, wind, and ice before being deposited in environments like rivers, lakes, and oceans, where they may eventually lithify to form sedimentary rock.