This happened to me as well, In my case, it was the battery. When the battery gets old it begins to swell, and the swelling causes a number of annoying side effects, like random clicking (battery presses on trackpad and click button), as well as pressing on caps lock key, and space bar. I haven't had the money to get a new battery yet, and so have been using my Mac with just the power adapter. Somewhat annoying because if I unplug it by accident it dies immediately, but much less annoying than the random clicking all over the place. Hope this helps someone!