This is how he knew. Though he didn't know who specifically was there, which is why he asked if they were democrats or republicans.
From the linked article:
The New York Times tipped off the GOP shooter on the GOP baseball practice field in an April article.
“When members of Congress practice in the early mornings in an Alexandrea, Va., public park for their Congressional Baseball Game, plainclothes United States Capital Police are sitting there in a blac S.U.V.”
While it cannot be known whether the would-be mass assassin saw the NYT article - probably other sources have published similar information - it is an answer to
rainbow4321's CT-mongering. The Congressional baseball game is a decades-long tradition, and the Congress-Critters' practices in preparation for it are public knowledge. The WH post on the Internet Trump's (and Obama before him, and probably "W" before him) daily schedule. Congress Critters have
similar schedule pages (McClintock's only lists townhalls, but others may list other sorts of events), and they also do press releases on issues and activities. As one of the first DU-folk to respond pointed out, the information is out there, publicly available for those who to find it.