Understanding the pain caused by an unhappy love affair can help you pick up the pieces — and start loving again