How to determine what caused this crack on the wall?
Cracks are almost always caused by shifting, vibrations or impacts.  Cracks in walls that are perfectly straight usually follow a seam where two pieces of drywall meet.  If the crack is just in the paint or the drywall then its unlikely itself to be a structural problem though there might be a more serious underlying problem.

Assuming it is drywall here, repairing it is the same as any other drywall repair - mud, sand, paint.