there is a ranking system for which leagues are the best. and based on those ranking systems, each league will have more representatives for the Cups.
For example England.
It is a top tier league therefore they will be given more slots for Champs League.
The top 2 of the EPL will get AUTOMATIC entrance into the Champs League. Which means Man Utd and Chelsea. However, the 3rd and 4th place teams Liverpool and Arsenal will play in the last qualifying rounds to enter the Champs League. If they win their 2 legged draw they will enter the Champs League, if they lose, they will be entered into the UEFA Cup. Now, after, 1 to 4, the EPL have UEFA Slots for teams 5 to 7. Which means England will be represented by Tottenham, Everton and Bolton. Now another way to enter the UEFA Cup is by winning the FA Cup in England. It gets even more complicated now because if a team that has already qualified for Europe wins the Cup, that Cup slot is given to the next available team. So it could be the team that finishes 8th or it could be the team that lost the FA Cup finals pending on their position on the table.
This sort of thing does not happen for all leagues because different leagues have different ranks and will go through different procedures. Over time you will learn how the system works and it does get adjusted pending on how certain teams from certain countries perform.