There are offices where computer programmers, on their first day, are given, among other supplies, a rubber duck. It is to sit on their desk until its needed.
In the words of Arthur Weasley, "What exactly is the function of a rubber duck?" Why would programmers keep a bath toy on their desk, and why would they ever need it?
Let me ask a different question: How often have you gotten stuck on a problem and been unable to progress because you just can't figure it out?
Feeling stuck? Talk to the duck.
What? Maxwell, have you gone mental? No, I'm quite sane, as are the many computer programmers with rubber ducks on their desks. Because when you run into a problem, you can spend hours, days, weeks running it around in your head and get nowhere. Come on, writers, hands up if you have. If there were an audience here, I'd probably be seeing every hand up.
Now think about this: of all those problems, how many times have you solved it ten seconds after you started talking to someone about it?
And I'm willing to bet, many times, the other person in the conversation didn't even need to say anything. You could have practically replaced them with... a rubber duck.
Some programmers have used this technique to solve coding issues for years: talk to the duck, explain what you're trying to do, and you'll figure out your logic error. In extreme cases, they'll bring in other programmers and THEIR ducks until three, four, five people and their ducks solve the problem.
In the same vein, tell a duck your plothole, and maybe, while explaining why it doesn't work, you'll figure out what can fix it. Or, if you feel silly talking to yourself aloud, you can type it out like you're chatting with the duck. Compose an email to the duck on why your main character is being frustrating and dismissive with the love interest (epiphany: she's actually in love with her best friend) or how this secret door's mechanic is stupid and doesn't make sense (realization: Why not use a remote control instead of the classic 'pull a book' method?) If you've got writing buddies, they make fantastic ducks, because they understand, and they've brought their duck, too. I have never once encountered a plot hole that couldn't be fixed by talking to the duck. Sometimes the ducks are named Kat and Bobo, and they've got a duck named Maggie. But whatever the name and whatever the technique, it works. It always works.
And that, Mr. Weasley, is the function of a rubber duck.