Form one (Ei, Ai, Aye - by itself):
Ei (eventually changed to Ai in middle English and Aye in modern English)
Used to confirm which group has a majority in a decision. It should never be the reply of an individual unless that person is representing a group. An example would be when a group votes yes or no. When the vote is counted if more votes are yes then the person representing the group would respond "Ei". In reference to the modern British use of the word, when the Vikings used to raid the coastlines they would take people prisoner to become conscripts, the crew would vote to kill the person or make them part of the crew. If they voted to make them part of the crew the reply to the captain would be a single "Ei"
It is important to note the word does not mean "Yes".
It simply means the majoirty or a group confirms or agrees.
Form two (when the word is used twice together Aye-Aye):
This literally translates - Always; ever
What this means is the person making the reply is saying he is professing his devotion to a group forever.
This was the oath taking by conscripts when joining the Norse Vikings.
The course of events followed that the crew would vote to allow a prisoner to live and make them part of the crew by voting "Ei" to the captain. The prisoner could then swear an oath to become part of the crew by responding to the captain "Ei-Ei". Meaning the crew has voted and I pledge to them always.
But, the expression was also used on the Viking ships when replying to the captain and is a reference to the oath they had sworn.
This is where the modern, misuse of the word comes from. The slang is a result of Ei-Ei which was always used to agree with the captain and over time became confused to mean "Yes". In fact it does not mean that at all.
It means one agrees to join a group forever and nothing else.
It is interesting because this history directly relates to the common phrase Yi-Ei-Man
Aye Aye (Ei Ei)Captain, I will do my part.