One of the most elementary theorems about Picard group is probably $\mathrm{Pic} (X \times \mathbb{A}^n) \cong \mathrm{Pic} X$ and $\mathrm{Pic} (X \times \mathbb{P}^n) \cong \mathrm{Pic} X \times \mathbb{Z}$ (we probably need some restriction for $X$ but let's forget about it for now). This looks very similar to the formulas for $\pi_1$ (the fundamental group). So, my question is whether the who has any relationship and whether one can prove those formulas of the Picard groups using some kind of deformation (as in Topology).

If your question concerns  as mentioned in one of your comments  if there is any relationship between them, then a very beautiful connection exists in what is called geometric class field theory: namely classical number theoretic class field theory concentrates around what is called Artin Reciprocity, which establishes an isomorphism for a number field $K$ and its ring of integers $\mathcal{O}_{K}$ an isomorphism $Pic(Spec(\mathcal{O}_{K})) \cong \pi_{1}^{ab}(Spec(\mathcal{O}_{K}))$ between the Picard group and the abelianized etale fundamental group (it is a geometric reformulation of classical Artin reciprocity). We can see it as a special case of onedimensional class field theory and the question arises naturally if we can extend somehow this correspondence for higher dimensions (and also for other one dimensional schemes). There are different approaches (Ktheory, cycle theory, geometric Langlands) but the main cornerstones are the following: BlochKaitoSaito Theorem: Let $X$ be a regular, connected, projective scheme over $Spec(\mathbb{Z})$, then there exists also a reciprocity map $Pic(X) \rightarrow \pi_{1}^{ab}(X)$ which is an isomorphism if in addition $X$ is flat over $Spec(\mathbb{Z})$. If $X$ factors through a finite field $k=\mathbb{F}_{q}$ then the reciprocity map is injective and with cokernel $\widehat{\mathbb{Z}}/\mathbb{Z}$. Also for curves over finite fields there exists a correspondence, namely if $C$ is a smooth, projective, geometrically irreducible curve over a finite field $k$, then there exists a reciprocity homomorphism $Pic_{C}(k) \rightarrow \pi_{1}^{ab}(C)$ which induces an isomorphism on the degree zero parts $Pic_{C}^{0}(k) \rightarrow \pi_{1}^{ab}(C)^{0}$, where the degree maps are the obvious maps to $\mathbb{Z}$ and $\widehat{\mathbb{Z}}$ resp. Also if $S \subset C$ is a finite set of points of a smooth, projective, geom. irreducible curve $C$ over a finite field, then there is a ramified version of the previous reciprocity, namely between $Pic_{C,S}$ (which is isomorphism classes of line bundles together with fixed isomorphisms of the stalks at every point in $S$) and the abelianization of the tame fundamental group of $U:=C \setminus S$. Some reference: http://epub.uniregensburg.de/13979/1/MP92.pdf and then it gives many other references and so on... 


I am not sure whether this is exactly what you want. But still, I see the following relation between $Pic$ and $\pi_1$: Let $k$ be an algebraically closed field and $X/k$ a proper variety. Then there is an isomorphism $H^1(X, \mathbb{Z}/n)=Hom(\pi_1(X), \mathbb{Z}/n)$. Furthermore, from the long exact cohomology sequence associated to $$0\to \mathbb{Z}/n\to \mathbb{G}_m\to \mathbb{G}_m\to 0$$ we obtain an isomorphism $$H^1(X, \mathbb{Z}/n)\cong H^1(X, \mathbb{G}_m)[n].$$ Here we used that $k$ is algebraically closed and that $X$ is proper over $k$. By a generalization of Hilbert 90 we have $H^1(X, \mathbb{G}_m)=Pic(X)$. (Cf. Milne's book, Chapter III, Proposition 4.9.) Hence, after all, we see that there is an isomorphism $$Hom(\pi_1(X), \mathbb{Z}/n)\cong Pic(X)[n].$$ I hope, this is of some use... (The cohomology groups used above are the etale ones.) 


$\def\Pic{\mathrm{Pic}}$ Suppose we are working on compact Kahler manifolds. We have short sequences: $$0 \to Pic^0(Z) \to \Pic(Z) \to NS(Z) \to 0 $$ $$0 \to H^1(Z, \mathbb{Z}) \to H^{0,1}(Z) \to \Pic^0(Z) \to 0$$ And we have the Lefchetz (1,1) theorem: $$NS(Z) = H^2(Z, \mathbb{Z}) \cap H^{1,1}(Z),$$ where the intersection takes place inside $H^2(Z, \mathbb{C})$. Suppose $X$ and $Y$ are connected. Applying the Kunneth theorem to everything in sight, we have $H^1(X \times Y, \mathbb{Z}) \cong H^1(X, \mathbb{Z}) \oplus H^1(Y, \mathbb{Z})$, $H^{0,1}(X \times Y) \cong H^{0,1}(X) \oplus H^{0,1}(Y)$, $H^2(X \times Y, \mathbb{Z}) \cong H^2(X, \mathbb{Z}) \oplus \left( H^1(X, \mathbb{Z}) \otimes H^1(Y, \mathbb{Z}) \right) \oplus H^2(Y, \mathbb{Z})$ (I might be missing a torsion term here, but I'll leave that issue for someone else to fix) and $H^{1,1}(X \times Y) \cong H^{1,1}(X) \oplus \left( H^{1,0}(X) \otimes H^{0,1}(Y) \oplus H^{0,1}(X) \otimes H^{1,0}(Y) \right) \oplus H^{1,1}(Y)$. We see that $\mathrm{Pic}^0(X \times Y) \cong \mathrm{Pic}^0(X) \times \Pic^0(Y)$ and that $NS(X \times Y) \cong NS(X) \oplus NS(Y) \oplus \left( \left( H^{1,0}(X) \otimes H^{0,1}(Y) \oplus H^{0,1}(X) \otimes H^{1,0}(Y) \right) \cap \left( H^1(X, \mathbb{Z}) \otimes H^1(Y, \mathbb{Z}) \right) \right)$. The trouble is ruling out that last term. In particular, the last term vanishes if $H^1(X)$ or $H^1(Y)$ is trivial. Even if both are nontrivial, there is no reason there has to be any class in this intersection: We are looking for $2$forms which both interact with the complex structure in a certain way and represent integral classes, and there is no reason there should be any. However, as the other answers show, sometimes there is. 


Not sure if this is what you're asking, but in general we don't have the equality $Pic(X \times Y) = Pic(X) \times Pic(Y)$, even if $X,Y$ are the nicest objects in town (say smooth projective varieties). I don't know how to go about actually doing this problem, but a counterexample is in everyones favorite book  problem 4.10 in Hartschorne. It says that for E an elliptic curve, that $Pic(E \times E) \neq Pic(E) \times Pic(E)$. 


I think using motivic cohomology, it can be shown that $\mathrm{Pic}(X \times Y) = \mathrm{Pic}(X) \oplus \mathrm{Hom}(\mathrm{Jac}(X), \mathrm{Jac}(Y)) \oplus \mathrm{Pic}(Y)$, or something like that, or perhaps $\mathrm{NS}$ instead of $\mathrm{Pic}$. 


First: The identity map on $X$ factors through the inclusion from $X$ to $X\times {\mathbb A}^1$. Therefore $Pic(X)$ is a direct summand of $Pic(X\times{\mathbb A}^1)$. This is the same argument you'd use in topology to show that $\pi_1(X)$ is a direct summand of $\pi_1(X\times I)$ ($I$ being the unit interval). To show that $Pic(X)$ is equal to all of $Pic(X\times {\mathbb A}^1)$, you can (as you surmise) take a class in $Pic(X\times {\mathbb A}^1)$ and ``deform'' it until it evidently comes from $X$. Here (roughly) is one way to do this: Represent your class by a divisor $D$. Pull $D$ back to a divisor on $X\times {\mathbb A}^1 \times {\mathbb A}^1$ along the map that sends $(x,s,t)$ to $(x,st)$. Call the pullback $D'$. Then $D'$ restricts to $D$ when $t=1$ and to a divisor that comes from $X$ when $t=0$. Call that latter divisor $D_0$. You can think of $D'$ as deforming $D$ into $D_0$, which completes the proof. The reason this deformation sets $D$ equal to $D_0$ in the Picard group is that you can think of $D'$ as (roughly) the graph of a function with zeros along $D_0$ and poles along $D$ (after a transformation that takes $1$ to infinity). That's exactly what it takes to make $DD_0$ trivial in the divisor class group, which, given appropriate assumptions, is the same as the Picard group. So yes, this kind of deformation is just what you need, and just what you've got. 

