Hail Sithis!

Talk to Nazir
First, the Dragonborn must talk to Nazir and tell him the Night Mother has spoken, and that the contract is still on.

Talk to Amaund Motierre
Travel to Whiterun and talk to Amaund Motierre in the back room of the The Bannered Mare, who will say that the Emperor is on the Katariah ship about to leave Skyrim. He also mentions that Commander Maro will be at the East Empire Company Warehouse docks, giving away an optional kill.

(Optional) Kill Commander Maro
One may be able to walk up onto the archway and kill him with an arrow, but the most likely route is to run down the docks and kill him, then flee from the guards towards the Katariah. (Talking to him with a clean bounty will cause him to attack the player, and the guards may side with the player.)

If the Stormcloak quest line is finished, there will be Stormcloak Guards on the docks that will help them kill Commander Maro. An amulet of waterbreathing can be extremely helpful for this situation. He can be talked to, which makes him attack, thus rendering killing him self-defense and not a crime, with amusing dialog starting the fight as he's shocked to see the Dragonborn alive.

Board the Katariah
Swim northeast along the river to the Katariah. Dive underwater and climb the anchor chain on the east side of the ship.

Kill the Emperor!
Once on board, there will be several sailors and Penitus Oculatus Agents. No need to worry if some of the guards on patrol or stationary within the ship are alerted, as it will not cause the entire ship to be alerted to their presence.

Go south to a dining room and climb the stairs to the main deck. An expert-locked door to the aft cabins is at the top of these stairs. Captain Avidius can be found in a forward cabin and drops the necessary Katariah Master Key. Use the master key or pick the lock to enter the aft cabin area. Upon entering, one can see that there is a room to the right with two Penitus Oculatus Agents, with smoke rising from the floor; they may be killed, with no negative effects. Continue up the stairs and there will be the master-locked door to the Emperor's Quarters; unlock with the master key. The key can also be obtained by killing the lieutenant who is in the room directly below the Emperor.

When proceeding inside the room, Emperor Titus Mede II will start talking. He is accepting his death, stating that this is their destiny. He will ask a favor however: kill whoever assigned the contract (Amaund Motierre). He gets up from his chair and proceed to turn his back and stare out a window, allowing for an easy kill.

After completing the kill, the door to the left should not be overlooked. It leads to the Emperor's sleeping quarters, and often, jewelry, gems, and armor can be found inside.

Report to Amaund Motierre
After the Emperor has been killed, escape the ship through the door to the right. After going through this door, just jump in the water or fast travel away. Then, go back to Whiterun and enter The Bannered Mare to talk to Amaund Motierre. He reveals the payment is in the dead drop in the cave where they first met.

Retrieve the payment
Travel to Volunruud and retrieve 20,000 from an urn in the same chamber where they first met. There is no need to clear the entire location.

(Optional) Kill Amaund Motierre
If the Dragonborn chooses to honor the Emperor's request to kill Motierre, return to Whiterun and dispatch him quietly in the rear of the Bannered Mare. He will say with his last words "But we had a.. deal...", and drop many valuable gems such as diamonds and sapphires.
 * If killing Amaund, immediately after gaining the location of the dead drop, jump up on the table, and backstab him with no consequences.
 * He also drops a Flawless Ruby, which is needed in the quest The Only Cure, this item is Semi-rare, so it is best to keep hold of this item. (Note: If the plan is killing Amaund for the Flawless Ruby, look in one of the rooms in the Emperor's Chamber, pass an expert lockpick or use the Emperor's key, look in the end table next to his bed and they will find a flawless ruby.)

Report to Nazir
After returning to Nazir at the Dawnstar Sanctuary, he asks how much Amaund Motierre left rewarded them for completing the assassination and the option to lie or not appear. Whether or not the truth is told, he will suggest to speak to Delvin Mallory in Riften to see about repairing the Dawnstar Sanctuary with the gold they were rewarded. In return, Nazir says that once the repairs are complete he will start recruiting new members to The Dark Brotherhood. This completes the quest and begins the next, Where You Hang Your Enemy's Head. In any case, the gold is kept and can be spent however wished.

Loot

 * In the Emperor's Room, to the left through the locked door (which is an expert lock, but can be unlocked using the Master Key) there is a copy of Lost Legends on his nightstand by his bed. Read it and it will start the quest Forbidden Legend (if it hasn' been done already).
 * There are also some valuable gems and necklaces in the room, as well as the only gilded wristguards and one of the three copies of Emperors Robes.
 * In front of Emperor Titus Mede II there is a book "Brother of Darkness" which tells some history of The Dark Brotherhood.
 * A map in front of him, which is the same as the cloth physical map that came with the game free of charge.
 * A book called "King" that will raise the two-handed skill next to the throne on the Quarterdeck of The Katariah above the Emperor's side of the ship.
 * On the opposite side on the Forecastle Deck, there is a Scimitar called "Windshear" stuck in the end of the Bowsprit (the long wooden beam protruding from the bow). Windshear has an enchantment where bash attacks using this weapon have a chance to knock down an opponent.


 * On the left side of the room, on a wall-mount, is a leveled Greatsword.

Trivia

 * Pickpocket (or simply kill) Amaund Motierre for various Precious Gems.
 * After this quest, guards in any hold mention the Emperor's death.
 * The Emperor has an extensive library aboard the ship.
 * Windshear, a unique Scimitar, can be obtained from the bowsprit of the ship.
 * The Night Mother's Truth is on the Emperor's Desk.
 * In the cabin next to the room with workbench, a sailor can be found crouched next to a bed. inside the cabin, a Penitus Oculatus and another sailor will both be found dead. Thus concluding that the first sailor killed them.
 * Sometimes when going to kill Maro a dragon may attack the dock, distracting guards making it easier to kill Maro.
 * The emperor will start attacking you if you turn into a werewolf after he gives you permission to kill him.
 * He will also attack you if you get caught pickpocketing him.

Bugs

 * After finishing the Civil War questline for the Stormcloaks, killing the emperor may cause Solitude guards to be hostile and not give the option of paying off a bounty. Cause is unknown but you can use the console commands SetObectiveCompleted DB11 20 1 to complete the objective of killing the emperor (without killing him) and SetStage DB11 50 to proceed to the next stage of the quest.
 * On the other hand, if you wish to continue by having the emperor dead, the console command "killall" will kill him without making the guards hostile.
 * There is a chance that after assassinating the Emperor you are unable to fast travel or wait. The message: "You cannot fast travel / wait while guards are pursuing you." will appear even though you are in another hold outside Solitude. Using the wait command removes this. If you cannot wait, jump off the boat and swim to shore. You may need to kill some Mudcrabs and/or Horkers. Afterwards, look at the boat and when the red dots indicating your enemies disappear you can now fast travel.
 * There is also a chance that Amaund Motierre will fall through the floor if you kill him while he is sitting in his chair.
 * There is also a chance when killing Amaund Motierre that Olava will appear in the room after you murder him. In one case, she said "By Sithis you are persistent one," and then proceeded to sit on Motierre's body. Her son spawned in the room immediately after that and said "You've been a good friend to me." Loaded them in the wrong building for some reason. Another player (PC) had Olava appear before killing Motierre and give a vague reading of the future (the new Sanctuary will be like a home), but the son never spawned. Olava was present for the execution of Motierre, but did not report it to the guards and no bounty was gained.
 * It is possible to only receive 100 from the urn, which there appears to be no fix for. Save before you open the urn.
 * There is a chance that after killing Commander Maro that the entire game will glitch and transport you between the Emperor's room on the ship and the courtyard outside the castle in Solitude.
 * On a rare occasion the boat you are supposed to climb into is actually invisible and forces NPCs to fall through the areas where floors are usually located. Once you climb onto the boat like you're supposed to the NPCs will start spawning behind you allowing you to kill them without them even noticing until they are almost dead. It also provides for an easier way of going through the ship seeing as most of the NPCs fell into the water and had to re-board the ship. So far the only fix for this is going onto the boat as scripted; or to reload from a previous save file before discovering the location.
 * There is a chance that after receiving the 'Hail Sithis' mission, entering the river where the boat the emperor can be found on, will crash your console.
 * As with the aforementioned Bug, I don't know if this exists at any specific level, but just trying to swim to the ship will cause the system to freeze up when you are about shoulder-deep in the water. The console will have to be restarted and both waiting and walking backwards into the water does not fix this. There is no conceivable fix; could be a lag that needs to be patched. (The water bug has been fixed as per the last patch)
 * This is less a bug than it is a combination of a bug and a hint. Before you enter the room in which the emperor resides, it is possible to interrupt his long dialogue. If you prep an arrow before entering the room, and then release the arrow while in the loading screen, as soon as the next room loads, your arrow will fly directly into the emperor's forehead. This will kill him before he automatically initiates a talking sequence with you (This is presuming your archery is high enough to kill him in one shot. If it isn't, you simply shoot him in the head before he talks to you.) The quest still goes on to completion normally if you choose this option.
 * If the player completed the Skyrim war questline for the Stormcloaks, and killed the emperor, the stormcloak guards will still say quotes about the emperor and how they feel, in which they wouldn't.
 * Not actually a bug, but if you are in the final stage of vampirism the emperor will not talk to you and give the quest to kill Amaund Moiterre.

Achievements
Hail Sithis