To begin with, you must determine who holds the copyright for the particular work, for example, who the publisher of the book or journal is. Contacting the publisher to ask permission is a reasonable next step.
With some larger publishers, you can often find a standard form for requesting permissions. This is sometimes a link on a website’s “contact us” or “terms/copyright” pages. Other times, you might find a “get permissions” link on pages for individual articles. These forms usually have boxes and drop-down menus to specify how much you want to use and for what purpose.
Otherwise, contact the copyright owner and advise them that you intend to use their work, detail the pages, graphs, diagrams, etcetera you want to use and how. Do this in writing so you have a record of the request. An example of a copyright permissions letter is linked below.
Typically, with Open Access material, you don't need to ask because the open access licence gives you permission up front.
There may also be non-copyright reasons why you can't copy something, like indigenous property rights.
TIP: If you have an image and you can't remember where you got it from, you can 'reverse search' for images using Google image search or Tineye. Basically, you can upload an image (rather than entering text) and the search will show you images it thinks are the same or similar. This can be useful in tracking down where images came from and who might own the copyright.
When you receive permission to use a work in your thesis, record the details, such as:
One way to record these is to use a Permissions log (an example is shared below). Another option is to use reference management software such as Endnote or Zotero.
In the thesis itself, you should not only attribute each source as you normally would but also add a rights statement such as 'Copyright XYZ Publishing, used with permission' or describe the licence that applies. For work licensed under Creative Commons, check their best practice for attributions.
Some copyright owners may not grant you permission to use their work. Some may not respond or exist anymore. If you don't hear back, that doesn't mean you can't use it. Some other options you can consider are: