Selecting squad for a series:
Each country has a cricket board. This board appoints selectors, who travel across various venues during that country's domestic season and watch a lot of players. Before any series, all the selectors sit along with the national captain and decide the merit of each top performer and select the team based on skill, consistency, requirement, team balance among other factors. Most of the top countries provide the captain (Who is again decided by the selectors) voting rights but it is not followed everywhere.
Selecting team for a match:
With the team that has been selected for the series, the captain can select any 11 players for each match of the series. The coach provides suggestions and helps the captain in making decisions, but ultimately the final decision lies with the captain.