How old is the earth?

The short answer is 4.54 billion years old. But how do we even know that? And what happened during all those billions of years before humans evolved?