My iPad mini 4 randomly turns off when i shake it!
You're holding it wrong! - Stop shaking it!

Seriously - you're experiencing problems with defective hardware. Take it to a proper repair shop and get a fixed price on fixing the issues.

You should probably prepare for the fact that buying a new iPad is cheaper than repairing the old.