Both men thought at length and wrote about depth psychology -- the idea that one should see "the human being as often divided against him or herself, with some thoughts, feelings, wishes, and memories accessible to awareness, and others hidden beneath the surface." [from http://www.pacifica.edu/about-pacifica/what-is-depth-psychology].
A somewhat superficial comparison can be made by listing similar terms and concepts both men explored in their writings, namely:
- the unconscious mind
- the repression of unacceptable feelings and thoughts
- repressed emotions and instinctual drives expressed in disguised ways
- the analysis of dreams as complex expressions of the unconscious loaded with symbolism
- the idea that the projection of hostile, unconscious feelings onto others is the basis of paranoid thinking
[The above list is taken from http://bjp.rcpsych.org/content/166/2/251 -- which is an abstract of an article published in The British Journal of Psychiatry February, 1995 -- "The influence of Nietzsche on Freud's ideas".]
Really, a book length study would be needed to do justice to a comparison (and, inevitably, contrast) of Nietzsche's and Freud's views of human behavior and psychology. If you care to look at some of the work which has already been done I think you could profitably begin by looking at several of Walter Kaufmann's books.
You could, for example, look at Kaufmann's Nietzsche: Philosopher, Psychologist, Antichrist. The third volume of Kaufmann's trilogy, Discovering the Mind, is devoted to Freud, Adler, and Jung, while the second volume discusses Nietzsche, Heidegger, and Buber. [Note that the later editions of the third volume, with the "new introduction by Ivan Soll", include an interesting discussion by Soll of Kaufmann's reading of Freud's various comments about Nietzsche's ideas and writings. Soll was, I believe, a student of Kaufmann's at Princeton and his writing conveys both his respect and admiration for Kaufmann while also questioning some of Kaufmann's thinking on whether or not Freud's denials of having read Nietzsche are to be accepted. In addition, a look at the index of names for the third volume will show a number of entries under "Nietzsche".]
Both Nietzsche and Freud are also discussed in a number of other books by Kaufmann. Critique of Religion and Philosophy, From Shakespeare to Existentialism, as well as the aforementioned volume 3 of Discovering the Mind are Kaufmann books in which some discussion of both men occurs, though not necessarily in the same sections. Consult the tables of contents and the indices to find such discussions.
Kaufmann was a great admirer of both Nietzsche and Freud, but he said he was neither a Nietzschean nor a Freudian. I.e. Kaufmann offered, in more than one of his published works, lengthy and detailed criticisms of some of each man's ideas.