How to change domain without losing its ranking
One can at least minimize the negative effects. However, we must know because it has been confirmed by a spokesman from Google, a fraction of PageRank acquired by each page is lost when the content is redirected.
That was verified experimentally.
The steps of domain change
Copy all the content on the new domain.
It is better to keep the same directory structure.
If you plan to change the design, do not at this moment, it is recommended by Google.
All significant changes in the site should be delayed.
Use a script to convert all absolute URLs of internal links.
A simple replacement of the old domain name for the new is enough.
Check meta canonical if any. If necessary, update their content.
Do a global 301 redirect.
Thus all the pages are redirected to the equivalent URL on the new domain.
It would be a wander to redirect all the content on the homepage of the new domain.
About external links, you can try to contact the webmasters to update their links on your site.
Some will, others may find easier to remove the link if is is not essential.
Google recommends that you keep the old domain for 180 days. Since only a portion of the external incoming links are lucky to be redirected, it is better to keep it several years in fact.
Go to Google Webmaster Tools (assuming that your old domain was registered).
Go to Settings -> Change of address.
Notify of domain change.
Register your new domain on GWT.
Keep the old one for monitoring.
Create a sitemap and notify on GWT.
Check in GWT for your old domain that there are no pages not found by the robots.
All this will allow you to keep your core audience. Lost PageRank will return after a few months.