There is an important rabbinic mitzvah to escort the deceased to his burial and to deal with all of the preparations for the burial. It is included in ואהבת לרעך כמוך - Love your fellow like yourself.
Honoring the Deceased at a Levaya
- All workers and professionals are supposed to stop their work to attend a levaya and there is no maximum amount of people attending the levaya at which point one would be exempt from attending the levaya. The only person for whom there is a distinction is someone who would otherwise be learning Torah.
- One should even stop learning in order to escort the deceased unless there are enough people escorting the deceased already to honor him.
- For someone who teaches Torah there is no maximum. For someone who learned Torah and Mishna the minimum honor he should receive is a levaya of at least 600,000 people escorting him. Someone who didn't learn should have at the levaya the amount of people necessary to do the burial and no less than ten.
- Someone teaching children shouldn't stop teaching for a levaya. Nowadays we would interrupt teaching of children for a levaya of a great talmid chacham or important supporter of Torah.
- If there is no chevra kaddisha then everyone in the town has to stop their work in order to prepare the person for burial. However, if there is a chevra kaddisha who is in charge of that then people only need to come during the levaya to the burial. Someone learning should only stop his learning at the time of the levaya to the burial but not during the preparations for the burial.
- Even if there are enough people available to do the burial if someone sees a levaya it is still incumbent upon a person to escort the deceased to the burial at least four amot.
- For a infant who didn't survive thirty days there is no mitzvah to have a levaya.
- Someone who sees the escorting of a non-Jewish funeral it is proper to join them. However, it is forbidden to enter a church even for this purpose.
Process of Levaya
- The company at a levaya says the tehillim of “yoshev bseter eylon” (Tehillim 91) starting with the pasuk v’yahey noam and concluded at the words “ki atta Hashem machsi”. For a woman eshet chayil is also recited.
- To the deceased it is proper to say "לך בשלום" and some add "ותעמוד לגורלך לקץ הימין".
- At a levaya no one should walk in front of the coffin except for those carrying the coffin who need to be there.
- One should not greet someone at the time of a levaya.
- One should not talk at a levaya useless speech.
- One may not greet a friend at a levaya in a cemetery.
- The minhag is that those carrying the coffin stop to be buried stop every 4 amot for a total of two or three times. There is no need to make these stops on days when there is no tziduk hadin. 
- Some have a practice to encircle the coffin and walk around it seven times reciting Yoshev Bseter Elyon, Anna Bkoach, Halach Lifanecha Tzidkecha, Kel Maleh, and Vehu rachum. These circuits or hakafot aren't done at night.
Who Should Attend a Levaya
- The minhag of Yerushalayim is that the descendants of the deceased don’t join in the levaya, however, outside Israel the minhag is that they do join the levaya.
- A pregnant woman may go to a levaya even though some have the practice not to.
- It is permitted to attend the levaya of someone who hated you.
Standing for the Levaya
- Someone who sees the coffin of a deceased being transported needs to stand up and also escort it. The reason we stand at a levaya is to honor those who transporting the coffin and doing a chesed.
- Someone who is only standing for a levaya and leaving should remain standing until the levaya passes from before one’s eyes.
- Brachot 18a, Shulchan Aruch 361:3
- Vayikra 19:18, Rambam (Avel 14:1)
- Ramban in Torat Haadam (p. 106) based on Yerushalmi Chagiga 1:7 cited by Bet Yosef, Shulchan Aruch YD 361:2
- The Netsiv (Emek Sheylah Chaye Sara 14:3, Vayechi 34:2) writes that someone who doesn’t see the deceased with the levaya doesn’t need to attend the levaya even if there isn’t enough people attending the levaya to honor the deceased. Chazon Ovadia (Aveilut v. 1 p. 298) writes that although it seems that other poskim disagree with the Netsiv it is acceptable to follow in order not to take time away from learning. See Minchat Elazar 1:26 and 4:2 accepts the Netsiv. The Chafetz Chaim (Ahavat Chesed v. 3 ch. 5) wonders why many people only participate in the levaya minimally and leave. See Tzitz Eliezer (Ramat Rachel 5:50:3) who quotes Sheilat Dovid Mkarlin who defends the minhag not to take off of work to join every levaya.
- Gemara Megillah 3b, Rosh (Moed Katan 3:61), Shulchan Aruch Y.D. 361:1
- The Shach 361:3 explains that 600,000 people are needed to honor a person who learned Torah because just like torah was given with 600,000 men in attendance so too when a person who embodies Torah is taken from the world 600,000 people should be in attendance.
- Shulchan Aruch YD 361:1. The Tur 361:1 quotes Rav Neturay Goan as stating that the minimum for a levaya is ten people. The Tur explains that this is in order to have enough people for a line to comfort the mourners after the burial (shurah), Kaddish, and Birkat Aveilim.
- Shulchan Aruch YD 361:1 writes that someone learning doesn't need to stop to check if there are enough people at the levaya as long as there are enough people to do the actual burial. The Shach 361:4 and Taz 361:1 explain that this only refers to someone who didn't learn Torah, however, for someone who learned since there needs to be 600,000 people in attendance the one learning can't assume that there is that already. Taz 361:1 writes that according to the Rama's minhag that we assume everyone learned Torah one does have to check unless someone teaching his students.
- Shulchan Aruch YD 361:1. The Rosh Moed Katan 3:61 quotes Rav Yom Tov Meyuni that someone who is teaching children Torah shouldn't stop for a levaya since the Gemara Shabbat 119b says that children learning Torah shouldn't stop for anything including the building of the Bet Hamikdash. Shach 361:6 cites this reason.
- Salmat Chaim YD 192, Chazon Ovadia (Aveilut v. 1 p. 307)
- Moed Katan 27b, Tosfot Ketubot 17a s.v. lehotzat, Shulchan Aruch YD 361:2
- Shulchan Aruch YD 361:3, Pitchei Teshuva 361:2 citing Yad Eliyahu
- Aruch Hashulchan 344:8, Nitai Gavriel (Aveilut v. 1 67:6)
- Chazon Ovadia (Aveilut v. 1 p. 317). See Kol Bo (114) and the citation of it in Bet Yosef 367:1
- Chazon Ovadia (Aveilut v. 1 p. 317)
- Chazon Ovadia (Aveilut v. 1 p. 302). The Chaye Adam (Nishmat Adam 5:2) writes that it is acceptable to read a half pasuk as part of tefillah and not kriyah.
- Chazon Ovadia (Aveilut v. 1 p. 302)
- Brachot 64a, Darkei Moshe YD 403:1
- Chazon Ovadia (Aveilut v. 1 p. 302)
- Aruch Hashulchan 358:5, Chazon Ovadia (Aveilut v. 1 p. 304)
- Aruch Hashulchan 343:4, Salmat Chaim YD 191, Nitai Gavriel (Aveilut v. 1 65:12)
- Shulchan Aruch YD 344:16, Chazon Ovadia (Aveilut v. 1 p. 303), Nitai Gavriel (Aveilut v. 1 65:19)
- Rama YD 343:2, Chazon Ovadia (Aveilut v. 1 p. 324)
- Rama YD 358:3. Shach 358:4 quotes the Levush who explains that the stops are to prevent bad spirits from attaching themselves and on days when there is no tziduk hadin there is no concern of these spirits.
- Chazon Ovadia (Aveilut v. 1 p. 325)
- Chazon Ovadia (Aveilut v. 1 p. 304)
- Nitai Gavriel (Aveilut v. 1 67:7), Chazon Ovadia (Aveilut v. 1 p. 313)
- Shach 335:2 quotes the Bach as saying that a person who is hated by someone shouldn't go to visit him when he is sick or comfort him when he is in mourning but can go to his levaya after he passes away. He adds that it depends on the situation.
- Shulchan Aruch YD 361:3-4
- Tur YD 361:4 citing the Yerushalmi Bikkurim 3:3 writes that we stand at a levaya to honor those doing a chesed for the deceased and not for the deceased himself. The Taz 361:2 broadens this concept to standing for anyone doing a mitzvah. His proof is the gemara Kiddushin 33a that everyone is supposed to stand for those bringing Bikkurim to Yerushalayim to honor those doing a mitzvah.
- Chazon Ovadia (Aveilut v. 1 p. 299) citing the Leket Yoshar and Chezkuni