Energy consumption is calculated as the product of power (in kilowatts) and time (in hours), resulting in kilowatt-hours (kWh). The cost is then found by multiplying the total energy consumed by the rate per kWh.