The reason you'd declare is because you can't
win a test match unless you bowl the other side out twice. And a test match cannot go longer than 5 days. So say for example that Australia made 340 runs in their first innings, and England made 376, giving England a 36 run lead. Lets say it's now late on day 4, and Australia has put on a massive attack and are now 6 for 531, which puts them 495 runs ahead.
If they wanted to, they could continue batting for as long as they held on to their remaining 4 wickets. But the problem is that as mentioned earlier, you can't win a test match unless you
bowl the other team out twice. If Australia were to bat on and ended up all out for 680, England would have no chance of winning, but neither would Australia because by then it would be half way through day 5 (the last day), and there probably wouldn't be enough time to bowl them out for the second time.
So what Australia should do is "declare their innings closed" at some stage on day 4 when they believe that they have enough of a lead to avoid actually getting beaten, but still have enough time to bowl England out. It's basically a balancing act between playing it safe and ending up with a draw, or declaring, going for the win, but risking a possible loss by giving them a chance.
Hope that made sense!
