E-commerce websites work by integrating various components such as a product catalog, shopping cart, and payment gateway. Customers browse the product catalog, add items to their shopping cart, and proceed to checkout where they complete the transaction using the payment gateway. The website then processes the order and arranges for shipping and delivery.