Integrating a IMU + PID + IK model for a biped robot?

I’m working on a humanoid robot and am currently stuck on creating a dynamic walking gait with inverse kinematics according to several IMUs and sensors. My plan is before I start working on the actual walking gait, I need to balance the robot according to data from my IMUs. However, I do not completely understand how to integrate the IMUs into my robot and do meaningful actions from them.

What I know/can do so far:
The IMU is mounted on the body of the robot, and I am able to read the data.
Control multiple servos at the same time.
Knowledge that IK is used to calculate where the point of interest (the foot of each leg) is and will need to be at.

Things I’m confused about:
How exactly do I convert all those calculations for IK into motion for my servos? For both legs?
How does the IMU fit into the above? Does it change the IK model, or is it just an additional variable to account for?
What does PID do in all of this? I saw James Bruton fit a PID system in his Robot X humanoid, but how does it work?

James Bruton’s Robot X (which used a PID along with a IMU): here
Humanoid robot kit I’m using: Sainsmart 17 DOF humanoid robot kit
IMU: MPU6050

Really appreciate it if someone could explain it in simple terms for a noob!

The IMU measures the basic quantities acceleration and rate of rotation about 3 axes. That is enough information to estimate relative 3D orientation (two tilt angles from horizontal and yaw, relative to start), but you need fairly advanced code for that. Jeff Rowberg's DMP library is popular.

The basic question is: how will you use the two tilt angles from the IMU in a meaningful way to control the walking behavior?

how will you use the two tilt angles from the IMU in a meaningful way to control the walking behavior?

My goal is to use the values from the IMU to sense if the robot tipped to one side too much during balancing and walking. Something similar to how we autocorrect on the fly when we are walking, running, or balancing on one leg.

Sounds like a good plan!

The only issue is I'm not sure how put them all together. I know that I should start off with the movement of the legs themselves, but I'm struggling to put in inverse kinematics into the legs. Anyone has a thread or a website that explains it with some sample code? I've searched for hours, but I haven't found anything that would help me move pass this problem. Thanks in advance!