This is by the consensus of the scholars because of the Hadith of Abu Hurayrah (may Allah be pleased with him) who said: "Hurry up with the dead body for if it was righteous, you are forwarding it to welfare; and if it was otherwise, then you are putting off an evil thing down your necks". 
Clarification of hastening: to be faster than normal walking (speed) but to increase beyond that. Great hastening is not required because it makes the carriers tired and something could come from the deceased that makes the shrouding dirty. Likewise being too slow is also not required because it goes against the Sunnah.
Ibn Al Qayyim (may Allah be pleased with him) said: "as for the habit of people to walk one step at a time, it is a disliked innovation that contradicts the Sunnah and liable to imitate the people of the book: (the Jews).
Firstly: the walking
The most clear, and Allah knows best, is that it is a broad issue. If he (the follower of the Janaza) wants he can walk in front of it or behind it to be near it and be a follower of it. In all the sides there are narrations of the companions (may Allah be pleased with them).
Proof to that:
A. The Hadith of Al Mugheera (may Allah be pleased with him) who said: the Prophet (peace be upon him) said: "A rider should go behind the bier, and those on foot should walk behind it, in front of it, on its right and on its left keeping near it. "
B. The Hadith of Anas (may Allah be pleased with him): "the Prophet (peace be upon him), Abu Bakr and Omar were walking at a Janaza walking in front of it and behind it." Al Albani said: "I said: this is a correct chain of narration on the condition of the two Sheikhs.
C. Until the mourners clear (the path). They do not follow one path as that might be difficult for them. Al Bukhari narrated in connection to this: Anas ibn Malik (may Allah be pleased with him) was asked about walking during the Janaza so he said: “in front of it and behind it; on its right and on it left. You are mourners.” Ibn Al Munthir connected (the narration) with it, may Allah be pleased with them. 
Secondly: The riding
What is clear and Allah knows best: the Sunnah is that the rider is behind the Janaza.
A. The previous Hadith of Al Mugheera (may Allah be pleased with him). In it: "A rider should go behind the bier".
B. Because if the rider is in front of the Janaza, he harms people behind him if they were any
Firstly: it is best if someone who is follows a Janaza to not be riding as its better to be walking because of the Hadith of Thoban (may Allah be pleased with him): "An animal was brought to the Messenger of Allah (peace be upon him) while he was going with a funeral. He refused to ride on it. When the funeral was away, the animal was brought to him and he rode on it. He was asked about it. He said: The angels were on their feet. I was not to ride while they were walking. When they went away, I rode. " 
As for riding after finishing, it is permissible because of the previous Hadith and because some of the people of knowledge dislike riding during participation but they did not dislike it after finishing from it.
Secondly: the greatness of participating in a Janaza is high. It is important for a Muslim to take heed in getting it (the reward) and not be ignorant of it. That is what came in the Hadith of Abu Hurayrah (may Allah be pleased with him) that the Prophet (peace be upon him) said: " (A believer) who accompanies the funeral procession of a Muslim out of sincere faith and hoping to attain Allah's reward and remains with it till the funeral prayer is offered and the burial ceremonies are over, he will return with a reward of two Qirats. Each Qirat is like the size of the (Mount) Uhud. ."
In another narration: " Whoever attends the funeral procession till he offers the funeral prayer for it, will get a reward equal to one Qirat, and whoever accompanies it till burial, will get a reward equal to two Qirats." It was asked, "What are two Qirats?" He replied, "Like two huge mountains..”
 Narrated by Al Bukhari number (1315). Narrated by Muslim number (944)
 Look at: Rad Al Ma’ad (1/517)
 Narrated by Abu Dawud number (3180). Narrated by At-Tirmidhy number (1011). Narrated by An-Nasa'y number (1944). Narrated by Ibn Majah number (1481). At-Tirmidhy said that it is a good authentic Hadith.
 Brought forward by Al Tahawi (1/278)
 Look at: Ahkam Al Janaiz (page 74)
 Look at: Fatah Al Bari (3/182)
 Look at: Al Awsat (5/383)
 Narrated by Abu Dawud number (3177). Al Albany authenticated him in Ahkam Al Janaiz (page 75)
 Narrated by Al Bukhari number (47)
 Narrated by Al Bukhari number (1325). Narrated by Muslim (945)
Please write: COMMENT in this box to verify that you are human