LAG(column) returns the value from the previous row, and LEAD(column) from the next row, in the order you give inside OVER:
SELECT customer_id, order_date,
order_date - LAG(order_date) OVER (PARTITION BY customer_id ORDER BY order_date) AS days_since_last
FROM orders;
PARTITION BY keeps each customer separate, so the first order of every customer has no previous row and gets NULL. Both functions take two optional arguments: how many rows to look (LAG(x, 2) is two rows back) and a default to use instead of NULL (LAG(x, 1, 0)).
Watch for gaps. "The previous row" is the previous row that exists, not the previous day or month. If a day has no reading, LAG reaches back to the day before. When the gap matters, return the previous date too and check it.