Could be that there was a problem on your end or the other players' end or the Mario Kart server. Nothing you can do about it most likely, so your best bet is to just try a new match. If the problems keep coming up, check your connection to see it's good. If you're on Wi-Fi then make sure it's not crowded, as other devices connected to the same Wi-Fi can affect your Wii U. If you're using a Wii LAN Adapter, then the problem likely isn't your fault.
That's the thing with online play... It either works, or it doesn't. Hope this helps!