Depending on the software you use, you can simply crop and rotate an image at the same time to straighten it, however if you are using Photoshop and want to quickly straighten your photo with a high degree of accuracy, here it is!
1. Open image in Photoshop.
2. Use the ruler tool and draw a line along a dominant edge that you want either vertical or horizontal.
3. Image –> Rotate Canvas –> Arbitrary –> OK
That’s it! Here is the end result: