The bridge tolls are infrastructure charges, which are charged to part-finance the construction of a new road, tunnel or mountain pass. That way the people who use the infrastructure help to pay for it.
The payment system is completely automatic. When you drive past a control point on the approach to the bridge, this is registered and a payment slip is sent to the owner of the vehicle.
The tax applies to vehicles registered in and outside of Sweden.