Sigmund Freud refused painkillers so he could choose the moment of his death, Susan Sontag fought it until the very end, Maurice Sendak drew it obsessively and John Updike wrote poems about it. Katie Roiphe finds beauty and comfort in the way great writers confronted their mortality