How could modern conditions and institutions such as the existence of electronic media or the huge cost of running for office challenge James Madison's ideas?
I assume that you are talking about Madison's idea that the greatest danger in a democracy is that of a majority overwhelming the rights of a minority. When talking about this, the minority that was most on his mind was the rich. He felt that those who were not rich would use their numbers to abuse the rights of the rich and to do things that would hurt the country's economy.
The things you mention challenge this because they help to give the rich a great deal of power over the electoral process. We can see that today with the emergence of the "Super PACs." We end up with individuals giving $1 million or more to try to impact an election. This challenges the idea of the many being able to overwhelm the few. It implies that the few can use their money to get their way and, perhaps, overwhelm the many.