Every card has the same chance of appearing, and since there are 52 card (13 for each suit), each of them has a chance of 1/52 to appear.
At the beginning, you a 26/52 = 1/2 chance of picking a spade or a heart (there are 13 spades and 13 hearts over a total of 52 cards).
Suppose you don't pick a spade or a hear (this happens in the remaining half of the cases). There are 51 cards remaining, and all 26 spades/hearts are still in the deck. So, you have a 26/51 chance of picking a spade or a heart with the second pick.
Putting everything together, you have

Which you should think of as "half of the times I pick a spade or a heart with the first card, the remaining half of the times I pick a spade or a heart with the second card with probability 26/51.
The expression evaluates to

***NOTE!!!***
What I just wrote is the probability of picking exactly one spade/heart. In fact, as you can see, if I pick a spade/heart with the first pick, the game ends. If you meant "what are the odds of picking at least one spade/heart, then the answer is simply

Because you have 26 "good" cards out of 52 possible cards with the first pick, and 26 "good" cards out of the remaining 51 if the first pick wasn't a spade nor a heart.