To answer my question at least partially I will add what I found out when reading ATP and WTA rulebook. In case I misunderstood something, I will be grateful for any corrections or new answers to my question. (This answer does not contain anything about Grand Slams and junior tournaments, which are governed by ITF. I also did not mention mixed doubles. But I think that it is very probable that the rules there are the same.)
In short, the seeding is decided based on combined ranking, which means adding together the rankings of the two players (in the ATP/WTA doubles ranking). In case the combined ranking are equal (for example, if players ranked 1 and 4 enter the tournament together and so do players number 2 and 3), further tie-breakers are used. They are specified in details in the ATP/WTA rulebook.
The relevant part from 2015 ATP rulebook:
VII. THE COMPETITION
7.13 Selection of Entries
C. Doubles Main Draw - ATP World Tour and ATP Challenger Tour Direct acceptances for ATP World Tour and ATP Challenger Tour events shall be in the following order:
1) Teams composed of players in either the Emirates ATP Rankings or the Emirates ATP Doubles Rankings. The combined positions of the two players (using best Emirates ATP Rankings (singles or doubles) shall be added together and the total used to determine the direct acceptances. The most recent Emirates ATP Rankings and/or Emirates ATP Doubles Rankings list, including a protected ranking, shall be used. Ties shall be resolved as follows:
a) Team using two (2) singles rankings.
b) Team using one (1) singles ranking.
c) A team using a protected ranking is positioned below the other team(s); if one player on each team is using a protected ranking then the position of each remaining player determines which team is positioned higher.
d) For ties between teams with the same composition, priority will be given to the team with the strongest individual Emirates ATP Rankings, including protected ranking, or for teams using two Emirates ATP Doubles Rankings, the fewest number of tournaments played and then the team with the highest number of points.
D. Seeds - ATP World Tour and ATP Challenger Tour
Seeded teams will be determined by using the combined Emirates ATP Doubles Rankings of the two players (protected ranking not included). Ties shall be broken as follows:
1) The team with the fewest events played is positioned higher.
2) The team with the highest number of points is positioned higher.
3) A coin flip or draw if a tie remains.
The relevant part from 2015 WTA Rulebook:
3. Doubles Main Draw
i. Doubles acceptance will be based on the WTA Doubles Rankings the week prior to the start of play (the same date rankings used for the singles seeding).
ii. Entry cutoffs and seeding will be determined by the highest combined ranking of the teams entered. If teams are tied, the tie-break procedure will be in the following order:
(a) Team with the greatest combined total points;
(b) Team with the highest combined ranking from the previous week; and
(c) Team with the fewest combined number of Tournaments played over the previous 52-week period.
iii. For entries and seeding, unranked players will be assigned a rank
of one (1) plus the lowest player listed on the most current ranking
used for the acceptances.