Apportionment is the process by which seats in a legislative body are distributed among electoral districts, such as states or parties, entitled to representation. The English Wikipedia page apportionment by country describes specific practices used around the world. The English Wikipedia page Mathematics of apportionment describes mathematical formulations and properties of apportionment rules.
One simple principle: elections should give each voter's intentions equal weight. This is stated in historical documents such as the Fourteenth Amendment to the United States Constitution (the Equal Protection Clause). However, there are a variety of historical and technical reasons why this principle is not followed absolutely or, in some cases, as a first priority.