How did Einstein come up with the solution of The Photoelectric Effect?

How did Einstein come up with the solution of The Photoelectric Effect?

P