Solution:
Answer: the maximal p equals 10092.
Write n=2019 and k=1009; then n=2k+1. We first show that we can place k2 pawns and n+k2 rooks. Each cell of the chess board has coordinates (x,y) with 1⩽x,y⩽n. We colour each cell black or white depending on whether x+y is even or odd.
Let A be cell (1,k+1), B be cell (k+1,1), C be cell (2k+1,k+1) and D be cell (k+1,2k+1), and consider the skew square ABCD. We place rooks on the cells of this square which have the same colour as A, and we place pawns on the other cells of this square. In this way, no rook can see another rook. Now we have placed p=k2 pawns and (k+1)2=k2+(2k+1)=p+n rooks.
Now we show that we can not place more pawns. Observe that in every row the number of rooks exceeds the number of pawns by at most 1, since there has to be a pawn between every two neighbouring rooks. So the total number of rooks exceeds the number of pawns by at most n. On the other hand we are to place p pawns and p+n rooks, so the number of rooks in every row exceeds the number of pawns by exactly 1. This means that the rooks and pawns alternate, with rooks at the two ends. For the columns the same holds.
Consider the ℓ-th row. Let a be the number of pawns in this row and let b be the number of pawns above the ℓ-th row. For all these pawns, a rook must be somewhere above it. Counting the rooks directly above these a+b pawns, we conclude that there must be at least a+b rooks in the first ℓ−1 rows. In every row the number of rooks exceeds the number of pawns by 1, so in these first ℓ−1 rows we have at least a+b−(ℓ−1) pawns. So b⩾a+b−(ℓ−1), yielding a⩽ℓ−1. We conclude that the ℓ-th row contains at most ℓ−1 pawns. The same holds for the ℓ-th row counted from below (row (n+1)−ℓ): also in this row, there are at most ℓ−1 pawns. As n=2k+1, the maximal number p is
ℓ=1∑k(ℓ−1)+ℓ=1∑k+1(ℓ−1)=k+2⋅21k(k−1)=k+k(k−1)=k2