With examples from Weiss Kreuz and Harry Potter.
Dictionaries from the OED to dictionary.com to Merriam-Webster list someone as both a definition and synonym of somebody, which means “some person.” Likewise, anyone is listed as both a definition and synonym of anybody, which means “any person.”
In other words, they’re interchangeable. As to why one would choose one over the other, that’s purely a matter of style. In some cases, one word might sound better than the other, or one word might be more commonly used than another--like in well-known sayings (“Give someone an inch, and they will take a mile,” “It’s anyone’s call,” and “Somebody stop me!”).
“No karaoke ever again,” Ken groaned. “Somebody should’ve stopped me after the first song.” He laid his head against the cool tabletop.
“Someone could have, but then we wouldn’t have it on YouTube,” Omi said from behind his laptop. The opening notes of “Single Ladies” began to play. “Look--a thousand hits and counting!”
“Has anyone seen my Bubotuber?” asked Neville frantically. “I left it here for repotting, but now it’s gone!”
“You’ve probably misplaced it,” Hermione said. “After all, why would anybody steal a Bubotuber?”
There’s no strict rule on which word to use when. If you’re looking for some sort of guidance, Garner’s Modern American Usage says that anyone shows up in print three times as often as anybody, and someone is similarly considered to be more pleasing to the ear and eye than somebody. But the choice is entirely yours--just pick the one that best suits your characters and fits with the rhythm of your prose.
Anybody, anyone, and somebody from AskOxford.com
Anybody, anyone, somebody, and someone from Dictionary.com
Anybody, anyone, somebody, and someone from Merriam-Webster.com
Garner’s Modern American Usage by Bryan Garner