When you hold yourself to your goal achievement, you are communicating to the universe (and to yourself) that the goal is a priority—it’s not just something that may or may not get done. If you don’t share your goals in some way, you aren’t truly committing to them. It’s too easy to give up because it’s like they never really existed.
Another reason accountability works is because it can motivate you to save face. It’s human nature to care about your reputation and to fulfil expectations of you. You also feel motivated to avoid being called out when you miss a goal.