Referencing is a system that allows you to acknowledge the contributions and work of others in your writing by citing your sources. A feature of academic writing is that it contains references to the words, information and ideas of others.
All academic essays MUST contain references. Referencing guards against plagiarism, a serious academic offence. Plagiarism is copying someone else's words or ideas and presenting them as your own.
See Plagiarism and academic integrity
Make sure you are familiar with the referencing style your faculty or school requires. Most have guides specifying the system they prefer. Often Schools/Faculties don't mind which system you use as long as it is consistent. If this is the case, use the system you are most comfortable with.
See The Learning Centre guides to various citation styles
Remember to list all the books and articles you use for the essay in a Reference List. This is a list of all works cited in your essay, and should be the final page.
Next step:Editing your essay
I almost write everything as it is and without paraphrasing or even citing, is that plagiarism?
Yup -- submitting work created by somebody else (the author of the textbook or course book) without crediting them is absolutely plagiarism. The solution, as you point out, is to cite them.
More worryingly for your educator, reading someone else's content -- even if properly cited -- makes it hard to evaluate whether you've understood the material. If the question is "How does pigeon domestication support the theory of natural selection?", you could quote directly from Charles Darwin's Origin of Species, chapter 1 --- but all that does is show that Darwin understood the connection! It's not clear if you understand the connection and, if I was grading your work, I'd want to know if there's evidence that you understand natural selection well enough to find a connection.
Other times, I get some ideas from outside the book and I do cite them in that case, however I do not paraphrase as I am learning by heart the thoughts in order to answer a specific question in the exam, is that plagiarism? (e.g. lack of paraphrasing)
Direct quotation isn't plagiarism as long as its properly cited; however, as I pointed out earlier, saying "Darwin (1859) believes that the connection between domestic pigeons and natural selection is ..." doesn't tell your evaluator much about whether you understand the connection, which is what they're trying to evaluate.
And lastly, since I am memorizing by heart, I sometimes misspell the name of an author or even change a bit of details in his or her idea, is that a bad thing?
For a closed book exam, definitely not -- it's understandable that you can't cite a work that isn't in front of you. For an open book exam, it would depend on your subject area: I teach biology, and I routinely overlook grammatical, spelling and minor mathematical errors as long as it's clear the student understands the biology they're describing.