How to add captcha on Civicrm contribution pages and Events pages
You can include a Profile in your Contribution Pages and Events and include recaptcha for it.

To set up your reCAPTCHA keys visit Administer > System Settings > Misc (/civicrm/admin/setting/misc?reset=1)

Then to set it in your Profile visit 

Administer -> Customise Data and Screens -> Profiles


Click on settings link for the profile added on your contribution page or event.
Expand the Advanced Settings tab
Enable the Include reCAPTCHA? checkbox and Save.