The reason why the number of seats keeps changing is a bit difficult to explain, but I'll try. The following is true for German federal election and most states, although not all (it is true for Bavaria). If there are elections in Germany the respective area is divided into election districts. You vote where your main residence is, either by mail or by going to a voting station.
Every voter has 2 votes, one party list vote and one candidate vote. The party list is an enumerated list of all candidates of that party. If a party gets 20% of the vote from all voting districts together and that equals 40 seats, the first 40 people on the list get a seat in parliament.
Every voting district also has a number of direct candidates (no more than one per party and no candidate can run for more than one district, and all candidates are also on the list of their respective parties). The candidate that wins a district is guaranteed a seat in parliament. This can lead to a situation where a party receives more seats than they would have by party vote alone (by a candidate winning its direct candidacy but not receiving a seat from the party list). To accommodate for this, additional seats are added to the parliament.
The German constitutional court ruled that no party may be disadvantaged by this system tho, so additional seats are added to the other parties to bring the ratio back in line with the party vote.
To make it more complicated, direct candidates don't have to be a member of a party, joining the parliament as independents. For those a seat is added, but no other seats are added as they ratio between the parties does not change. The same is true for direct candidates who win their voting district but their party does not make it into the parliament because the party failed to receive 5% of the vote.