It's easier to understand if you split the code in two parts.
The first part $("#reviews").append("...") is rjs. This means that it is ruby code that will get transformed to javascript code and then sent to the client. This piece concretely will use javascript to add something to any dom node with class "reviews" - but that is not important for your question. What is important is that you will be generating javascript.
Another important thing to take into account is that in this particular case, the javascript uses a string, generated by ruby - the "...". It is one string with double quotes(""). Hold on to that knowledge piece for a moment.
Now think of what render(:partial => @review) is doing.
It is rendering a partial - which means that it could be rendering any kind of code - html, css ... or even more javascript!
So, what happens if our partial renders something like this?
<a href="/mycontroller/myaction">Action!</a>
Remember that your javascript was taking a double-quoted string as a parameter? Now see what you are generating - inmediately after the href= there is a double quote character! That will close your string before it should!
$("#reviews").append("<a href="/mycontroller/myaction">Action!</a> ") #gives you an error
In order for this not to happen, you want to escape these special characters so your string is not cut - like this:
<a href=\"/mycontroller/myaction\">Action!</a>
This is done by using escape_javascript.
$("#reviews").append("<a href=\"/mycontroller/myaction\">Action!</a>")
Regards!