For OS X versions from Lion up to El Capitan.
The
The simplest way - if available to you - is to use your Purchase History on the App Store.
If you have ever previously installed any OS X version, it will still be available to you from that list. This should include any public beta versions too.
If none of these methods are available to you, you have two options #If none of these methods are available to you, you have two options
If you need to create a bootable USB to install from
How do I make a bootable USB OS X installer on a Mac?