How linear interpolation works between mipmaps?
It's called trilinear interpolation. You first do a bilinear interpolation of the higher-res texture, then do a bilinear interpolation on the lower-res texture, then interpolate between the 2 results. The weight of the final interpolation is based on where between the 2 textures your Z-coordinate falls. If 0 is fully the low-res texture and 1 is fully the high-res texture, then you can use the standard glsl mix() function to combine the two:

result = (highres texture color * weight) + (lowres texture color * (1.0 - weight));