What was the purpose of sacrifice, both animal and human in early religious practices?
I would say that one of the basic aims of ancient sacrifice in cultures such as those of the ancient Hebrews, Greeks, or Romans was to gain the favor of a divinity. One reason why ancient people made sacrifices was because they thought that it would give the divinity pleasure. We also see this view in Odyssey 1:
Poseidon was visiting the distant Ethiopians...to accept a hetacomb of sacrificial bulls and rams, and there he sat, enjoying the feast... (A.S. Kline translation)
Connected to this is the idea of pleasing the divinity was the view that the divinity would give the human being something in exchange for the sacrifice: Some modern scholars refer to this as the principle of do ut des, a Latin phrase that means "I give so that you may give." This view can be found in the first book of Homer's Odyssey, where Athene says to her father Zeus:
Odysseus...only longs to die. Yet, Olympian, your heart is unmoved. Did he win no favour with the sacrifices he made you...? Why do you will this man such pain, Zeus?
We even see this idea of do ut des in the biblical book of Genesis. God tells Abraham to sacrifice his son Isaac, but at the last second prevents Abraham from doing so and provides a ram instead. Because of Abraham's obedience, God says to him (Genesis 22:16-18):
...because thou hast done this thing, and hast not withheld thy son, thine only son: 17: That in blessing I will bless thee,...and thy seed shall possess the gate of his enemies; 18: And in thy seed shall all the nations of the earth be blessed; because thou hast obeyed my voice. (King James translation)
From these remarks, it becomes clear that even the gods were aware that human beings sacrificed to them with a view towards getting them to do something for them in return.