What's the strategy for computing the Picard group of a variety with more than one irreducible components? 


For instance, consider the simple case where $X$ has two components $C$ and $D$, meeting transversely at one point. Then it seems that $\text{Pic}(X)=\text{Pic}(C)\times\text{Pic}(D),$ but I don't know how to prove it.


Thanks.


**Edit:** I'd like to see a formal proof (or a reference), i.e. using cohomology etc., instead of using "gluing", especially when we are not gluing along open intersections. The map $C\coprod D\to X$ is not flat, so there's no fppf gluing either.



Picard group of reducible varieties
I will only consider the case of connected projective (this is not really necessary) curves $X, C, D$. over an algebraically closed field $k$. The canonical injection $O\_X\to O\_C\times O\_D$ induces an exact sequence of sheaves on $X$ 
$$ 1 \to O\_X^\* \to O\_C^\* \times O\_D^\* \to F \to 1 $$
where $F$ is a skyscrapper sheaf supported at the intersection points of $C$ and $D$. Passing to cohomology,
we get 
$$ 1 \to k^\* \to k^\* \times k^\* \to F(X) \to \mathrm{Pic}(X)\to \mathrm{Pic}(C) \times \mathrm{Pic}(D)\to H^1(X, F)=0.$$ 
When $C, D$ intersect transversally at a single point (ordinary double point), a local computation shows that $k^\* \times k^\*\to F(X)$ is surjective, and you get your isomorphism. 


As Steven said, this really depends on how $C$ and $D$ intersect (in fact, when $C$ and $D$ are smooth, your isomorphism implies that $C$ and $D$ intersect transversally at a single point; non transversal intersection point can give additive subgroup in $\mathrm{Pic}(X)$ and more transversally intersection points give subtori in $\mathrm{Pic}(X)$). Also in higher dimension $H^1(X, F)$ may not vanish, and the above methode does not work. 


The general picture for proper curves can be found in Bosch, Lütkebohmert and Raynaud, Néron Models, Chap. 9., §2. They make a ''dévissage'' of $\mathrm{Pic}^0(X)$. 


[**EDIT**] Let me rewrite Sándor's nice interpretation in cohomological terms. It will make explicit the sheaf $F$ above and gives a better understanding of what is going on, and in any dimension. Denote by $E=C\cap D$ the closed subscheme defined by the ideal $J\_C+J\_D$. Then we have an exact sequence of sheave on $X$: 
$$ 1 \to O\_X^\* \to O\_C^\* \times O\_D^\* \to O^\*\_{E} \to 1 $$ 
in the middle, the map is $(a, b)\mapsto a|\_E (b|\_E)^{-1}$. The exactness is checked locally. Passing to cohomology, we get
$$ O(C)^\star\times O(D)^\star\to O(E)^\* \to \mathrm{Pic}(X) \to \mathrm{Pic}(C)\times \mathrm{Pic}(D)\to \mathrm{Pic}(E)$$
and the last map is $(L, H)\mapsto L\_{|E}\otimes (H\_{|E})^{-1}$, therefore the exact sequence becomes


$$ O(C)^\star\times O(D)^\star\to O(E)^\star \to \mathrm{Pic}(X) \to \mathrm{Pic}(C)\times\_{\mathrm{Pic}(E)} \mathrm{Pic}(D)\to 1.$$
So Sándor's map $\mathrm{Pic}(X) \to \mathrm{Pic}(C)\times\_{\mathrm{Pic}(E)} \mathrm{Pic}(D)$ is always surjective. It is injective if and only if $O(C)^\star\times O(D)^\star\to O(E)^\star$ is surjective. This is not always the case (consider two irreducible curves meeting at more than one point or meeting at a single point but not transversally which implies that $E$ is a non-reduced point), but is true if for instance $O(E)=k$ (e.g. $E$ is geometrically connected, geometrically reduced **and proper**). 


[**EDIT 2**] Of course, in all this answer, $X$ is supposed to be **reduced**. Otherwise $O\_X\to O\_C\times O\_D$ (and that one with invertible functions) would not be necessarily injective. If $X$ is not reduced, there is a dévissage from $\mathrm{Pic}(X)$ to $\mathrm{Pic}(X\_{\mathrm{red}})$ in Bosch & al, *op. cit.* 


