I appeal to you therefore, brothers, by the mercies of God, to present your bodies as a living sacrifice, holy and acceptable to God, which is your spiritual worship. Do not be conformed to this world, but be transformed by the renewal of your mind, that by testing you may discern what is the will of God, what is good and acceptable and perfect. Romans 12.1-2
For survey's sake, Paul's letter to the Romans can be divided into two main parts - the first is basically descriptive, while the second is mostly prescriptive.
Briefly, descriptive texts describe something that has happened. So we derive a lot of what we know about God, and about the life of righteousness, by reading these descriptive texts that tell us what happened. For example, we know that God is triune because of what happened at Jesus' baptism. In Matthew 3.16-17, as Jesus (the Son) was baptized, a dove (the Spirit) descended to rest on him, and a voice (the Father) said, "This is my Son, in whom I am well pleased." All three Persons of God are visible in this text, and as Matthew describes the event, we infer that God is three-in-one.
Prescriptive texts are those that prescribe actions, so that we learn what to do and what not to do. For example, we know not to steal because God spoke into the Law, "You shall not steal" (Ex. 20.15). And on the other hand, we should put God's words into practice, because we have a command in James 1.22, "Be doers of the word, and not hearers only...."
Romans is (for the most part) descriptive from chapters 1-11. Paul describes God's revelation of Himself and His righteousness (1-8), and Israel's part in that revelation (9-11). Chapters 12-16 are mostly prescriptive, and give us practical implications of, and instructions for, applying the righteousness of God.
These verses (12.1-2) are at the exact intersection of these two halves of Romans.
"I appeal to you therefore..."
"Therefore" refers back to chapters 1-11. Since Paul is gearing up to tell us (prescribe) in chapters 12-16 how to live as a follower of Jesus, he leans on everything about God he has described in chapters 1-11. In other words, our obedience to his instructions in the second half of the book, should be because of everything that happened in the first half, ie. man's exchanging the truth for a lie, God's giving the law, the story of Abraham, and God's faithfulness to His covenant people Israel.
"brothers, by the mercies of God,... "
"By the mercies of God" also points back to chapters 1-11, where God is shown to save freely and out of His mercy, not owing to anything in us.
"to present your bodies as a living sacrifice, holy and acceptable to God, which is your spiritual worship."
This is Old Testament speak. Paul uses language and imagery from Israel's past sacrificial system to illustrate that our bodies, indeed our whole lives, should be devoted and "sacrificed" to God (Heb. 13.15-16) - in the same way that, before Jesus, animals were sacrificed as an acceptable act of worship to God (see Lev. 1-7).
"Do not be conformed to this world, but be transformed by the renewal of your mind,..."
How are our minds transformed? By hiding the word of God in our hearts (Ps 119.11), and letting it reshape who we are.
"that by testing you may discern what is the will of God, what is good and acceptable and perfect."
This phrase "that by testing you may discern" is translated from the Greek "dokimazo." It gives the sense of finding out if something is valuable by putting it to use. As our minds are transformed and as we are tested, we learn the value and greatness of the will of God. And the will of God is good. It is acceptable. And it is perfect.