We would notice its gravitational effects on other objects. We’ve also sent plenty of space probes that would have directly observed such a planet, but we wouldn’t have needed to to detect it. [EDIT: and as /u/antithesys correctly notes, Earth’s orbit is elliptical and varies in speed, so the two objects would wobble around that 180-degree alignment – although I think Earth’s orbit is actually close enough to circular that the other body would never be visible.]
But it turns out we don’t even need *that*, because the orbital configuration you’re describing isn’t stable. Any unevenness away from exactly 180 degrees apart will tend to grow, and the objects will end up taking [horseshoe orbits](https://en.wikipedia.org/wiki/Horseshoe_orbit) (from the perspective of the other object) that would render them visible at times.
Such a configuration exists today for [two of Saturn’s moons](https://en.wikipedia.org/wiki/Epimetheus_(moon)#Orbit), which share an orbit but trade-off for which moon is “ahead” and which is “behind” in the orbit; the two moons come quite close to one another but never collide.
In fact, it’s believed that this *did* happen for Earth in the early Solar System. Earth is believed to have shared its orbit with a Mars-sized body called [Theia](https://en.wikipedia.org/wiki/Theia_(planet)). But unlike the Saturn system, perturbations from the gravity of the other planets made Theia’s orbit unstable with respect to the Earth, and eventually led to a collision that was probably the most violent event in the history of our planet. The resulting debris formed Earth’s Moon.
Latest Answers