When to paraphrase and why
Paraphrasing is necessary when you want to take the thought or idea expressed in a source, but not the exact language the source uses. You must do this to avoid plagiarism, which is problematic for two reasons: first, by copying the words of someone else, you are passing of their work as your own. This is an issue because you are stealing the intellectual property of someone else. Furthermore, another problem is that, by using the mode of expression of someone else, you fail to prove that you yourself understand the material. But by using your own words, you demonstrate a personal understanding of the content.
But there are other times when it is best to quote directly from the source. These are normally in instances where the precise language used is highly important to your analysis or argument. For example, in literary analysis papers, or when presenting a position for discussion or criticism. Effectively, you should quote directly if paraphrasing risks corrupting or changing the source's meaning in some way, or when the language itself is the focus of the analysis. For a more comprehensive overview, see here.
How to paraphrase
When reading through a source, try to understand it as a whole first rather than getting fixated on individual words and phrases. Establishing a sense of order/narrative in your head not only helps you see the wider picture the source is presenting, but will also facilitate recall in future.
Be conscious that sources are supposed to inform your work, not comprise it. What I mean by that is you need to be discerning with what you choose to include in your write-up, since you won't have space for everything. Select and summarise the material that allows you to make a complete and justified point in your writing.
A useful exercise to help with paraphrasing is to imagine that you are explaining the content to a friend or family member (who knows little about your subject area). How would you explain it to them in plain terms? Of course, you don't want to water the source material down excessively in your write-up; you want to show that you can accurately use technical terminology, but make it as clear, ordered, and direct as possible.
Another exercise is to read through the source several times - until you feel you could explain it to someone else - then try to summarise it on paper without looking. While helping practice paraphrasing, this will again aid with understanding and recall.
With regards to the paraphrasing itself, there are two things to focus on: language and structure. Both are necessary for effective paraphrasing; synonymising alone is not sufficient.
Structural changes will depend on the focus of your essay. Of course, you must strip only what is relevant to your paper. This will often involve breaking up passages and sentences in the source. You will have to repurpose these excerpts such that they slot in cohesively to the paragraph they are being interpolated into, which might mean a little contextual exposition is required to make it work. Furthermore, you should not be afraid of combining shorter sentences, collapsing longer ones, expanding for clarity, and contracting for concision. Naturally, what you choose to do will depend on the paper and the source(s).
Concerning language: yes, it is okay to swap words for synonyms. But you should also consider substituting literal expressions for phrases, and vice versa. Language is so multiplicious; there are innumerable ways to convey a thought or idea, and plenty of tools to help you do so (think figures of speech, such as metaphor and metonymy). If you're struggling with this aspect, it might be time to pull out your GCSE English textbook.