On pages with multiple headings, a [[WP:TOC|table of contents]] listing the headings is automatically generated. When this occurs, the table of contents box will appear on the left side of the page between the lead section and the first heading. There will be no text to the right of the table of contents, though an image or a vertical template, such as an [[WP:INFOBOX|infobox]], will appear in the space to the right if formatting causes it to require that space. Still, no text will appear in the space in between; it'll be white (as you notice, there is some white space between the TOC box and the image above).
There are various ways to modify the appearing of the table of contents. Entering the templates {{Tlx|TOC left}} or {{Tlx|TOC right}} at the top of the page will produce a table of contents to the left or right that does share its lines with some text. The [[Help:Magic words|magic word]] <nowiki>__NOTOC__</nowiki> will cause the table of contents to be altogether absent, which for some pages may be necessary.
It is also possible to produce your own table of contents as follows:<br />
In an automatically generated table of contents, there will be one listing per line. But in a self-produced table of contents, multiple listings can be condensed into one line, as much as space allows, using the line break (<nowiki><br /></nowiki>) text to mark the end of a line. The drawback to this is that you will have to manually add, remove, or modify headings as they are edited on the page. Still, it'll reduce the amount of whitespace on the page.