How can I calculate my gas mileage and what is a normal gas mileage?

What could cause gas mileage to go up or down?