Once a bird has laid an egg that egg needs a lot of attention: it will need incubating by a parent and protecting from predators / competitors. This must take up a lot of the parents' time meaning that they have less time to feed and surely makes them more prone to predation.

Wouldn't it be better for the bird to lay an egg only when it is ready to hatch thus minimising the threat to them?

There's twp obvious advantages to this strategy (well, potential ones, different species / clades do things different ways and there will always be different benefits and trade offs). Firstly, if you wait till the egg has nearly hatched, you have to carry it round the whole time. That's a lot of extra weight and effort and for a bird this is clearly an issue. If you can dump that weight as an egg and then occasiaonlly leave it for a bit (or for ages if it's with your partner) then actually it's a good thing to be rid of.

The second issue is that many birds lay a great number of eggs. Sicne they are produced over a period, each can be quite large and collectively may be as large or larger than the mother. Obviously that's not possible if you want to keep them internally so that's another clear benefit.