Serendipitous mathematical discoveries in recent times As of today, most important results in mathematics are conjectured long before they are proven.
Are there any examples of (important) mathematical discoveries that were proven by chance rather than from the authors conducting a targeted research on a hypothesis? I'm interested especially in results obtained in the last 100 years or so.
 A: I would like to expand a bit on the comment made by @AlexR, citing the so-called Monstrous Moonshine.
The Monstrous Moonshine is a link - that stayed elusive for a long time, and was worth Richard Borcherds a fields medal for making it explicit - between two apparently unrelated domains: irreducible representations of the Monster group (whence the name) and modular forms. The serendipitous remark was the following:
The Fourier expansion of the $j$-invariant (some function on the upper half complex plane with some interesting properties) is given by
$$j(\tau) = \frac{1}{q} + 744 + 196884q + 21493760q^2+\ldots$$
where $q=e^{2\pi i\tau}$. At the same time, we have the Monster group, i.e. the biggest of the sporadic finite simple groups. We look at its smallest irreducible representations and notice they have dimension $r_1 = 1$ (the trivial representation), $r_2 = 196883$, $r_3 = 21296876$,... Those two sequences of numbers are eerily similar, and in fact one notices that $196884 = r_1 + r_2$ and $r_1+r_2+r_3$ (and similar identities also hold for higher coefficients of the Fourier expansion and higher dimensional irreducible representations). This was remarked by McKay in 1978, and the natural question that arose is: Is there some hidden structure that explains those apparently nonsensical relations?
This question stimulated a great deal of research, and an answer was reached with the work of Borcherds in 1992 via vertex operator algebras.
A: Not sure if I can call this a mathematical result, as this phenomenon is far from understood, but I think that the notion of Ulam spiral is famous enough and was discovered by chance.
A: Until the summer of 1960 most historians and philosophers (and arguably many mathematicians) believed (following Bishop Berkeley, Moigno, Cantor, Russell, and others) that infinitesimals (as a possible foundation for analysis) had been proven inconsistent and consigned to the dustbin of history.  Cantor actually published a purported "proof" of inconsistency of infinitesimals that influenced numerous scholars like Russell, as analyzed by Philip Ehrlich in this 2006 article.
Walking toward Fine Hall at Princeton University in the fall of 1960 Abraham Robinson realized that a way can be found to make infinitesimals (as a possible foundation for analysis) rigorous. For additional details see Dauben's biography of Robinson:
Dauben, J. Abraham Robinson, The Creation of Nonstandard Analysis: A Personal and Mathematical Odyssey (Princeton, N.J.: Princeton University Press, 1995).
This serendipitous discovery explained why the historical mathematicians like Leibniz, Euler, and Cauchy made so few mistakes in manipulating infinitesimals, and set the ground for a fruitful area of research. 
Abraham Fraenkel wrote in the 1960s that "my student Robinson saved the honor of infinitesimals."
Robinson's framework has been recently championed by Terry Tao who argues for the conceptual advantages of using the hyperreals and hyperreal-related structures.
A: Does Srinivasa Ramanujan count as a mathematical discovery?
This is admittedly a 'cutesy' sort of answer for this type of question, but my tongue is just barely in my cheek here. G. H. Hardy, a hugely productive and influential mathematician in his own right*, was asked once in an interview what he thought his greatest contribution to mathematics was. He immediately replied with Ramanujan. It's scary to think how easily Ramanujan could have remained an anonymous man in India who filled up notebooks with jibberish in his spare time.

*Bohr famously remarked, "Nowadays, there are only three really great English mathematicians: Hardy, Littlewood, and Hardy–Littlewood." Presumably he hadn't been introduced to Ramanujan. :)
A: What is "important" and what is "mathematical"?
The first time I encountered the word "serendipity"
was in an engineering context, this one:

Are Finite Elements important? Sure they are in e.g. Structural Mechanics.
Are Finite Elements mathematical? Oh well, they are quite a bit practical,
but that doesn't mean they aren't 
interesting
for theoretical mathematics.




A: Candes's and Romberg's perfect reconstruction of the Logan-Shepp phantom, leading to the pioneering work in Compressed Sensing, was unexpected.  Terence Tao tells the story here:
https://mathoverflow.net/questions/178139/examples-of-unexpected-mathematical-images/178210#178210
A: A fun instance in proof-theory. 
The Curry-Howard correspondence links computational calculi to logical systems. In particular, there are (old) isomorphisms between a Hilbert-style deduction system and combinators, and between natural deduction and lambda-calculus, both in the case of intuitionist logic. It was widely believed that there wasn't anything similar for classical logic, or rather logicians all knew it was an impossible task, because classical logic didn't have any computational meaning. (Note: classical logic is intuitionist logic with the law of excluded middle, $A\vee \neg A$, added as an inference rule.)
But in 1989, a computer scientist, who didn't know it was impossible, did it: he gave a type system for Scheme, with the $\texttt{call/cc}$ primitive, which was typed by Peirce's law, a rule equivalent to the law of excluded middle. From that the Curry-Howard isomorphism was generalized to classical logic and then many more complex calculi, which greatly influenced the field of proof theory, influencing proof assistants and programming language design. 
A: 
In 1979-80 when Benoit Mandelbrot was a Visiting Professor of Mathematics at Harvard University he had the chance to use the brand new Vax computer. On the $1$st March $1980$ he had a first detailed picture of an island molecule in the Mandelbrot set for
  \begin{align*}
z\rightarrow z^2-c
\end{align*}

B. Mandelbrot wrote in his contribution Fractals and the Rebirth of Iteration Theory in The Beauty of Fractals by Heinz-Otto Peitgen and Peter Richter:

... The beauty of many fractals is the more extraordinary for its having been wholly unexpected ...

A: The accidental discovery of chaos by Edward Lorenz in 1963 (see here), but have in mind also the work of Boris Chirikov (see here).
